From 97f8dfd74dd5a011b68f34d9c556231c47f2beaa Mon Sep 17 00:00:00 2001 From: Sean Goldin Date: Sun, 22 Jan 2023 08:47:44 -0600 Subject: [PATCH] Add localisation plurals (#239) * Add localisation plurals * Add more languages to plurals * Remove unused localised keys * Update per #225 --- IceCubesApp.xcodeproj/project.pbxproj | 34 +++++++++++++++++++ .../Plurals/de.lproj/Localizable.stringsdict | 22 ++++++++++++ .../Plurals/en.lproj/Localizable.stringsdict | 22 ++++++++++++ .../Plurals/es.lproj/Localizable.stringsdict | 22 ++++++++++++ .../Plurals/it.lproj/Localizable.stringsdict | 22 ++++++++++++ .../Plurals/nl.lproj/Localizable.stringsdict | 22 ++++++++++++ .../zh-Hans.lproj/Localizable.stringsdict | 22 ++++++++++++ .../Localization/de.lproj/Localizable.strings | 1 - .../Localization/en.lproj/Localizable.strings | 1 - .../Localization/es.lproj/Localizable.strings | 1 - .../Localization/it.lproj/Localizable.strings | 1 - .../Localization/nl.lproj/Localizable.strings | 3 +- .../zh-Hans.lproj/Localizable.strings | 1 - .../Sources/Timeline/TimelineViewModel.swift | 2 +- 14 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 IceCubesApp/Resources/Localization/Plurals/de.lproj/Localizable.stringsdict create mode 100644 IceCubesApp/Resources/Localization/Plurals/en.lproj/Localizable.stringsdict create mode 100644 IceCubesApp/Resources/Localization/Plurals/es.lproj/Localizable.stringsdict create mode 100644 IceCubesApp/Resources/Localization/Plurals/it.lproj/Localizable.stringsdict create mode 100644 IceCubesApp/Resources/Localization/Plurals/nl.lproj/Localizable.stringsdict create mode 100644 IceCubesApp/Resources/Localization/Plurals/zh-Hans.lproj/Localizable.stringsdict diff --git a/IceCubesApp.xcodeproj/project.pbxproj b/IceCubesApp.xcodeproj/project.pbxproj index f0283b48..10a55e96 100644 --- a/IceCubesApp.xcodeproj/project.pbxproj +++ b/IceCubesApp.xcodeproj/project.pbxproj @@ -8,6 +8,9 @@ /* Begin PBXBuildFile section */ 639CDF9C296AC82F00C35E58 /* SafariRouteur.swift in Sources */ = {isa = PBXBuildFile; fileRef = 639CDF9B296AC82F00C35E58 /* SafariRouteur.swift */; }; + 7429BCE2297C55D00069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; }; + 7429BCE5297C5A750069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; }; + 7429BCE6297C5A750069A946 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 7429BCE4297C55D00069A946 /* Localizable.stringsdict */; }; 9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F24EEB729360C330042359D /* Preview Assets.xcassets */; }; 9F295540292B6C3400E0E81B /* Timeline in Frameworks */ = {isa = PBXBuildFile; productRef = 9F29553F292B6C3400E0E81B /* Timeline */; }; 9F2A540729699698009B2D7C /* SupportAppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2A540629699698009B2D7C /* SupportAppView.swift */; }; @@ -103,6 +106,12 @@ /* Begin PBXFileReference section */ 639CDF9B296AC82F00C35E58 /* SafariRouteur.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariRouteur.swift; sourceTree = ""; }; + 7429BCE3297C55D00069A946 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; + 7429BCE7297C5D010069A946 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = nl; path = nl.lproj/Localizable.stringsdict; sourceTree = ""; }; + 7429BCE8297C5D020069A946 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Localizable.stringsdict; sourceTree = ""; }; + 7429BCE9297C5D030069A946 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = es; path = es.lproj/Localizable.stringsdict; sourceTree = ""; }; + 7429BCEB297D65380069A946 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.stringsdict"; sourceTree = ""; }; + 7429BCEC297D65390069A946 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = it; path = it.lproj/Localizable.stringsdict; sourceTree = ""; }; 9606B7A1297AD2BB00C1FB75 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; 9F24EEB729360C330042359D /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 9F29553D292B67B600E0E81B /* Network */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Network; path = Packages/Network; sourceTree = ""; }; @@ -214,6 +223,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 7429BCEA297C64CF0069A946 /* Plurals */ = { + isa = PBXGroup; + children = ( + 7429BCE4297C55D00069A946 /* Localizable.stringsdict */, + ); + path = Plurals; + sourceTree = ""; + }; 9F2A5417296AB631009B2D7C /* IceCubesNotifications */ = { isa = PBXGroup; children = ( @@ -356,6 +373,7 @@ E9B576C029743F2A00BCE646 /* Localization */ = { isa = PBXGroup; children = ( + 7429BCEA297C64CF0069A946 /* Plurals */, E9B576C529743F4C00BCE646 /* Localizable.strings */, ); path = Localization; @@ -503,6 +521,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7429BCE5297C5A750069A946 /* Localizable.stringsdict in Resources */, 9F8CA5982979B63D00481E8E /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -513,6 +532,7 @@ files = ( 9FAD858E29743F7400496AB1 /* (null) in Resources */, 9F8CA5972979B61100481E8E /* Localizable.strings in Resources */, + 7429BCE6297C5A750069A946 /* Localizable.stringsdict in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -523,6 +543,7 @@ 9F2A542C296B1177009B2D7C /* glass.caf in Resources */, E9B576C329743F4C00BCE646 /* Localizable.strings in Resources */, 9FD34823293D06E800DB0EE9 /* Assets.xcassets in Resources */, + 7429BCE2297C55D00069A946 /* Localizable.stringsdict in Resources */, 9F24EEB829360C330042359D /* Preview Assets.xcassets in Resources */, 9FAD85832971BF7200496AB1 /* Secret.plist in Resources */, 9F2A542E296B1CC0009B2D7C /* glass.wav in Resources */, @@ -593,6 +614,19 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 7429BCE4297C55D00069A946 /* Localizable.stringsdict */ = { + isa = PBXVariantGroup; + children = ( + 7429BCE3297C55D00069A946 /* en */, + 7429BCE7297C5D010069A946 /* nl */, + 7429BCE8297C5D020069A946 /* de */, + 7429BCE9297C5D030069A946 /* es */, + 7429BCEB297D65380069A946 /* zh-Hans */, + 7429BCEC297D65390069A946 /* it */, + ); + name = Localizable.stringsdict; + sourceTree = ""; + }; E9B576C529743F4C00BCE646 /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/IceCubesApp/Resources/Localization/Plurals/de.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/de.lproj/Localizable.stringsdict new file mode 100644 index 00000000..92ebeeb3 --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/de.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + ein neuer Post + other + %lld neue Posts + + + + diff --git a/IceCubesApp/Resources/Localization/Plurals/en.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/en.lproj/Localizable.stringsdict new file mode 100644 index 00000000..c9bc21f2 --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/en.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + %lld new post + other + %lld new posts + + + + diff --git a/IceCubesApp/Resources/Localization/Plurals/es.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/es.lproj/Localizable.stringsdict new file mode 100644 index 00000000..096a41d7 --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/es.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + %lld new post + other + %lld nuevas publicaciones + + + + diff --git a/IceCubesApp/Resources/Localization/Plurals/it.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/it.lproj/Localizable.stringsdict new file mode 100644 index 00000000..80652626 --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/it.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + %lld new post + other + %lld nuovi messaggi + + + + diff --git a/IceCubesApp/Resources/Localization/Plurals/nl.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/nl.lproj/Localizable.stringsdict new file mode 100644 index 00000000..d78d007d --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/nl.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + %lld new post + other + %lld nieuwe posts + + + + diff --git a/IceCubesApp/Resources/Localization/Plurals/zh-Hans.lproj/Localizable.stringsdict b/IceCubesApp/Resources/Localization/Plurals/zh-Hans.lproj/Localizable.stringsdict new file mode 100644 index 00000000..e7f32d11 --- /dev/null +++ b/IceCubesApp/Resources/Localization/Plurals/zh-Hans.lproj/Localizable.stringsdict @@ -0,0 +1,22 @@ + + + + + timeline-new-posts %lld + + NSStringLocalizedFormatKey + %#@timelineNewPosts@ + timelineNewPosts + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + one + %lld new post + other + %lld 个新嘟文 + + + + diff --git a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings index f9ca3f8d..6ef41278 100644 --- a/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/de.lproj/Localizable.strings @@ -237,7 +237,6 @@ "notifications.tab.mentions" = "Erwähnungen"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld neue Posts"; "timeline.federated" = "Föderiert"; "timeline.home" = "Startseite"; "timeline.local" = "Lokal"; diff --git a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings index c57a2756..743df558 100644 --- a/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/en.lproj/Localizable.strings @@ -237,7 +237,6 @@ "notifications.tab.mentions" = "Mentions"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld new posts"; "timeline.federated" = "Federated"; "timeline.home" = "Home"; "timeline.local" = "Local"; diff --git a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings index 22631fab..25501a47 100644 --- a/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/es.lproj/Localizable.strings @@ -237,7 +237,6 @@ "notifications.tab.mentions" = "Menciones"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld nuevas publicaciones"; "timeline.federated" = "Federado"; "timeline.home" = "Inicio"; "timeline.local" = "Local"; diff --git a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings index fa4a2f13..ab604a1a 100644 --- a/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/it.lproj/Localizable.strings @@ -237,7 +237,6 @@ "notifications.tab.mentions" = "Menzioni"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld nuovi messaggi"; "timeline.federated" = "Federazione"; "timeline.home" = "Home"; "timeline.local" = "Locale"; diff --git a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings index 1125fba8..ab5b9d6d 100644 --- a/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/nl.lproj/Localizable.strings @@ -237,9 +237,8 @@ "notifications.tab.mentions" = "Vermeldingen"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld nieuwe posts"; "timeline.federated" = "Gefedereerd"; -"timeline.home" = "Thuis"; +"timeline.home" = "Startpagina"; "timeline.local" = "Lokaal"; "timeline.n-recent-from-n-participants %lld %lld" = "%lld recente posts van %lld deelnemers"; "timeline.trending" = "Trending"; diff --git a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings index d5f9669b..4feaa16b 100644 --- a/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings +++ b/IceCubesApp/Resources/Localization/zh-Hans.lproj/Localizable.strings @@ -237,7 +237,6 @@ "notifications.tab.mentions" = "提及"; // MARK: Package: Timeline -"timeline.n-new-posts %lld" = "%lld 个新嘟文"; "timeline.federated" = "跨站"; "timeline.home" = "主页"; "timeline.local" = "本地"; diff --git a/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift b/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift index 3390346c..4b53094d 100644 --- a/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift +++ b/Packages/Timeline/Sources/Timeline/TimelineViewModel.swift @@ -49,7 +49,7 @@ class TimelineViewModel: ObservableObject, StatusesFetcher { var pendingStatusesButtonTitle: LocalizedStringKey { switch pendingStatusesState { case .stream, .refresh: - return "timeline.n-new-posts \(pendingStatuses.count)" + return "timeline-new-posts \(pendingStatuses.count)" } }