Skip to content

Commit

Permalink
Adds Dutch localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
hungrxyz committed Nov 9, 2020
1 parent edff04f commit 4e3432a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 36 deletions.
21 changes: 20 additions & 1 deletion Infected.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
AD07C24625521A6E009B27B2 /* Area.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD07C24425521A6E009B27B2 /* Area.swift */; };
AD07C24C25521AA3009B27B2 /* AnyArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD07C24B25521AA3009B27B2 /* AnyArea.swift */; };
AD07C24D25521AA3009B27B2 /* AnyArea.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD07C24B25521AA3009B27B2 /* AnyArea.swift */; };
AD131CBE2559D393003077F3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD131CC02559D393003077F3 /* Localizable.strings */; };
AD131CCA2559D94C003077F3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD131CC02559D393003077F3 /* Localizable.strings */; };
AD327F26254629EC002CCE01 /* NumbersDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD327F25254629EC002CCE01 /* NumbersDTO.swift */; };
AD327F2C2546332E002CCE01 /* NumbersProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD327F2B2546332E002CCE01 /* NumbersProvider.swift */; };
AD327F32254633B7002CCE01 /* Numbers.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD327F31254633B7002CCE01 /* Numbers.swift */; };
Expand Down Expand Up @@ -87,6 +89,8 @@
/* Begin PBXFileReference section */
AD07C24425521A6E009B27B2 /* Area.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Area.swift; sourceTree = "<group>"; };
AD07C24B25521AA3009B27B2 /* AnyArea.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyArea.swift; sourceTree = "<group>"; };
AD131CBF2559D393003077F3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
AD131CC52559D39D003077F3 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
AD327F25254629EC002CCE01 /* NumbersDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersDTO.swift; sourceTree = "<group>"; };
AD327F2B2546332E002CCE01 /* NumbersProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersProvider.swift; sourceTree = "<group>"; };
AD327F31254633B7002CCE01 /* Numbers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Numbers.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -221,6 +225,7 @@
ADE73A8E254DDEB700C9FBD4 /* NumberRepresentation.swift */,
ADE73A35254B612900C9FBD4 /* TrendNumberView.swift */,
ADD4C309251627920064A959 /* Assets.xcassets */,
AD131CC02559D393003077F3 /* Localizable.strings */,
ADD4C30E251627920064A959 /* Info.plist */,
ADD4C30B251627920064A959 /* Preview Content */,
);
Expand Down Expand Up @@ -365,7 +370,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
nl,
);
mainGroup = ADD4C2F9251627910064A959;
packageReferences = (
Expand All @@ -389,6 +394,7 @@
buildActionMask = 2147483647;
files = (
ADBB7CE72517C1DC00F3C8B4 /* Assets.xcassets in Resources */,
AD131CCA2559D94C003077F3 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -397,6 +403,7 @@
buildActionMask = 2147483647;
files = (
ADD4C30D251627920064A959 /* Preview Assets.xcassets in Resources */,
AD131CBE2559D393003077F3 /* Localizable.strings in Resources */,
ADD4C30A251627920064A959 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -495,6 +502,18 @@
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
AD131CC02559D393003077F3 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
AD131CBF2559D393003077F3 /* en */,
AD131CC52559D39D003077F3 /* nl */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
ADBB7CED2517C1DC00F3C8B4 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
26 changes: 0 additions & 26 deletions Infected/NumberRepresentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,3 @@ enum NumberRepresentation {
case deaths

}

extension NumberRepresentation {

var displayName: String {
switch self {
case .cases:
return "Cases"
case .hospitalizations:
return "Hospitalizations"
case .deaths:
return "Deaths"
}
}

var symbolName: String {
switch self {
case .cases:
return "folder.fill.badge.plus"
case .hospitalizations:
return "cross.case.fill"
case .deaths:
return "heart.broken.fill"
}
}

}
2 changes: 1 addition & 1 deletion Infected/Numbers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extension Numbers {
extension NationalNumbers: Area {

var name: String {
"Netherlands"
NSLocalizedString("Netherlands", comment: "")
}

static var demo: NationalNumbers {
Expand Down
28 changes: 27 additions & 1 deletion Infected/RowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct RowView: View {
default:
Image(systemName: representation.symbolName)
}
Text(representation.displayName)
Text(representation.displayNameLocalizedStringKey)
}
.font(.system(.headline, design: .rounded))
.foregroundColor(.secondary)
Expand Down Expand Up @@ -85,3 +85,29 @@ struct RowView_Previews: PreviewProvider {
.padding()
}
}

private extension NumberRepresentation {

var displayNameLocalizedStringKey: LocalizedStringKey {
switch self {
case .cases:
return "Cases"
case .hospitalizations:
return "Hospitalizations"
case .deaths:
return "Deaths"
}
}

var symbolName: String {
switch self {
case .cases:
return "folder.fill.badge.plus"
case .hospitalizations:
return "cross.case.fill"
case .deaths:
return "heart.broken.fill"
}
}

}
24 changes: 24 additions & 0 deletions Infected/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Localizable.strings
Infected

Created by marko on 11/9/20.

*/

"Netherlands" = "Netherlands";
"Unknown" = "Unknown";
"Provinces" = "Provinces";
"Municipalities" = "Municipalities";
"Cases" = "Cases";
"New Cases" = "New Cases";
"Hospitalizations" = "Hospitalizations";
"Deaths" = "Deaths";
"Areas" = "Areas";
"All Areas" = "All Areas";
"No latest numbers" = "No latest numbers.";
"New" = "New";
"Trend" = "Trend";
"Total" = "Total";
"Latest Numbers" = "Latest Numbers";
"Shows latest COVID-19 numbers in the Netherlands." = "Shows latest COVID-19 numbers in the Netherlands.";
24 changes: 24 additions & 0 deletions Infected/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Localizable.strings
Infected

Created by marko on 11/9/20.

*/

"Netherlands" = "Nederland";
"Unknown" = "Onbekend";
"Provinces" = "Provincies";
"Municipalities" = "Gemeenten";
"Cases" = "Gevallen";
"New Cases" = "Nieuw Gevallen";
"Hospitalizations" = "Ziekenhuisopnames";
"Deaths" = "Overlijdens";
"Areas" = "Gebieden";
"All Areas" = "Alle Gebieden";
"No latest numbers" = "Geen laatste cijfers.";
"New" = "Nieuw";
"Trend" = "Trend";
"Total" = "Totaal";
"Latest Numbers" = "Nieuwste Nummers";
"Shows latest COVID-19 numbers in the Netherlands." = "Toont de nieuwste COVID-19 nummers in Nederland.";
14 changes: 7 additions & 7 deletions InfectedWidget/InfectedWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ struct InfectedWidgetEntryView : View {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("NL - \(Self.dateFormatter.string(from: entry.numbers.latest.date))")
.font(Font.system(size: 15, weight: .semibold))
.font(Font.system(size: 14, weight: .semibold))
.foregroundColor(.secondary)
NumbersView(
kindText: "New Cases",
kindLocalizedStringKey: "New Cases",
latestNumber: entry.numbers.latest.cases ?? 0,
trendNumber: entry.numbers.casesDifferenceToPreviousDay ?? 0
)
NumbersView(
kindText: "Hospitalizations",
kindLocalizedStringKey: "Hospitalizations",
latestNumber: entry.numbers.latest.hospitalizations ?? 0,
trendNumber: entry.numbers.hospitalizationsDifferenceToPreviousDay ?? 0
)
NumbersView(
kindText: "Deaths",
kindLocalizedStringKey: "Deaths",
latestNumber: entry.numbers.latest.deaths ?? 0,
trendNumber: entry.numbers.deathsDifferenceToPreviousDay ?? 0
)
Expand All @@ -107,13 +107,13 @@ struct InfectedWidgetEntryView : View {
return formatter
}()

let kindText: String
let kindLocalizedStringKey: LocalizedStringKey
let latestNumber: Int
let trendNumber: Int

var body: some View {
VStack(alignment: .leading) {
Text(kindText)
Text(kindLocalizedStringKey)
.font(.system(size: 12, weight: .regular))
.foregroundColor(.secondary)
HStack(alignment: .lastTextBaseline, spacing: 4) {
Expand All @@ -139,7 +139,7 @@ struct InfectedWidget: Widget {
InfectedWidgetEntryView(entry: entry)
}
.configurationDisplayName("Latest Numbers")
.description("Displays latest infection numbers in the Netherlands.")
.description("Shows latest COVID-19 numbers in the Netherlands.")
.supportedFamilies([.systemSmall])
}
}
Expand Down

0 comments on commit 4e3432a

Please sign in to comment.