From 173b22b772104f9159091d3b0fc9be26ec0df433 Mon Sep 17 00:00:00 2001 From: Terry Yiu <963907+tyiu@users.noreply.github.com> Date: Sat, 14 Jan 2023 14:24:48 -0500 Subject: [PATCH] localization: fix string bugs Closes: #321 --- .../Localized Contents/en-US.xliff | 70 ++++------- .../damus/en-US.lproj/Localizable.strings | Bin 22588 -> 22398 bytes .../damus/en-US.lproj/Localizable.stringsdict | 34 +++--- .../Localized Contents/es-419.xliff | 77 ++++++------ .../damus/en-US.lproj/Localizable.strings | Bin 22588 -> 22398 bytes .../damus/en-US.lproj/Localizable.stringsdict | 34 +++--- damus/ContentView.swift | 13 +- damus/Models/Mentions.swift | 6 +- damus/en-US.lproj/Localizable.stringsdict | 34 +++--- damus/es-419.lproj/Localizable.stringsdict | 112 ++++++++++++++++-- 10 files changed, 235 insertions(+), 145 deletions(-) diff --git a/damus Localizations/en-US.xcloc/Localized Contents/en-US.xliff b/damus Localizations/en-US.xcloc/Localized Contents/en-US.xliff index fc098ab..4764bed 100644 --- a/damus Localizations/en-US.xcloc/Localized Contents/en-US.xliff +++ b/damus Localizations/en-US.xcloc/Localized Contents/en-US.xliff @@ -85,16 +85,6 @@ Number of profiles a user is following. (Profile.displayName(profile: profile, pubkey: whos))'s Followers Navigation bar title for view that shows who is following a user. - - (formattedSats) sat - (formattedSats) sat - Amount of 1 sat. - - - (formattedSats) sats - (formattedSats) sats - Amount of sats. - (who) following (who) following @@ -868,6 +858,11 @@ Part of a larger sentence to describe how many profiles a user is following.satoshi Example username of Bitcoin creator(s), Satoshi Nakamoto. + + sats_count + sats_count + Amount of sats. (Key in .stringsdict) + tips_count tips_count @@ -896,8 +891,8 @@ Part of a larger sentence to describe how many profiles a user is following. - 1 other note - 1 other note + %d other note + %d other note Text to indicate that the thread was collapsed and that there are other notes to view if tapped. @@ -905,11 +900,6 @@ Part of a larger sentence to describe how many profiles a user is following.%d other notes Text to indicate that the thread was collapsed and that there are other notes to view if tapped. - - 0 other notes - 0 other notes - Text to indicate that the thread was collapsed and that there are other notes to view if tapped. - ··· %#@NOTES@ ··· ··· %#@NOTES@ ··· @@ -925,11 +915,6 @@ Part of a larger sentence to describe how many profiles a user is following.Followers Part of a larger sentence to describe how many people are following a user. - - Followers - Followers - Part of a larger sentence to describe how many people are following a user. - %#@FOLLOWERS@ %#@FOLLOWERS@ @@ -950,11 +935,6 @@ Part of a larger sentence to describe how many profiles a user is following.Reactions Part of a larger sentence to describe how many reactions there are on a post. - - Reactions - Reactions - Part of a larger sentence to describe how many reactions there are on a post. - %#@RELAYS@ %#@RELAYS@ @@ -970,19 +950,14 @@ Part of a larger sentence to describe how many profiles a user is following.Relays Part of a larger sentence to describe how many relay servers a user is connected. - - Relays - Relays - Part of a larger sentence to describe how many relay servers a user is connected. - Replying to %@%#@OTHERS@ Replying to %@%#@OTHERS@ Label to indicate that the user is replying to 1 user and others. - & 1 other - & 1 other + & %d other + & %d other Label to indicate that the user is replying to 1 user and others. @@ -1001,8 +976,8 @@ Part of a larger sentence to describe how many profiles a user is following.Label to indicate that the user is replying to 2 users and others. - & 1 other - & 1 other + & %d other + & %d other Label to indicate that the user is replying to 2 users and others. @@ -1030,10 +1005,20 @@ Part of a larger sentence to describe how many profiles a user is following.Reposts Part of a larger sentence to describe how many reposts there are. - - Reposts - Reposts - Part of a larger sentence to describe how many reposts there are. + + %1$#@SATS@ + %1$#@SATS@ + Amount of sats. + + + %2$@ sat + %2$@ sat + Amount of sats. + + + %2$@ sats + %2$@ sats + Amount of sats. %#@TIPS@ @@ -1050,11 +1035,6 @@ Part of a larger sentence to describe how many profiles a user is following.Tips Part of a larger sentence to describe how many tip payments there are on a post. - - Tips - Tips - Part of a larger sentence to describe how many tip payments there are on a post. - diff --git a/damus Localizations/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings b/damus Localizations/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings index 38e15f8aabddcc78d76f6ad1b56c5b8d738fb279..462b7249a1b58b32192121dcefc45363b202abc3 100644 GIT binary patch delta 50 zcmdn9f$`ruMyCJ&CSNd+nf!stWpfAP4d;ooG?NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - 0 other notes one - 1 other note + %d other note other %d other notes @@ -30,8 +28,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Followers one Follower other @@ -48,8 +44,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reactions one Reaction other @@ -66,8 +60,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Relays one Relay other @@ -87,7 +79,7 @@ zero one - & 1 other + & %d other other & %d others @@ -105,7 +97,7 @@ zero one - & 1 other + & %d other other & %d others @@ -120,14 +112,28 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reposts one Repost other Reposts + sats_count + + NSStringLocalizedFormatKey + %1$#@SATS@ + SATS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + @ + one + %2$@ sat + other + %2$@ sats + + tips_count NSStringLocalizedFormatKey @@ -138,8 +144,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Tips one Tip other diff --git a/damus Localizations/es-419.xcloc/Localized Contents/es-419.xliff b/damus Localizations/es-419.xcloc/Localized Contents/es-419.xliff index bb55718..a965367 100644 --- a/damus Localizations/es-419.xcloc/Localized Contents/es-419.xliff +++ b/damus Localizations/es-419.xcloc/Localized Contents/es-419.xliff @@ -71,14 +71,6 @@ Number of profiles a user is following. (Profile.displayName(profile: profile, pubkey: whos))'s Followers Navigation bar title for view that shows who is following a user. - - (formattedSats) sat - Amount of 1 sat. - - - (formattedSats) sats - Amount of sats. - (who) following Navigation bar title for view that shows who a user is following. @@ -700,6 +692,10 @@ Part of a larger sentence to describe how many profiles a user is following.satoshi Example username of Bitcoin creator(s), Satoshi Nakamoto. + + sats_count + Amount of sats. (Key in .stringsdict) + tips_count Part of a larger sentence to describe how many tip payments there are on a post. (Key in .stringsdict) @@ -724,8 +720,8 @@ Part of a larger sentence to describe how many profiles a user is following. - 1 other note - 1 other note + %d other note + %d other note Text to indicate that the thread was collapsed and that there are other notes to view if tapped. @@ -733,11 +729,6 @@ Part of a larger sentence to describe how many profiles a user is following.%d other notes Text to indicate that the thread was collapsed and that there are other notes to view if tapped. - - 0 other notes - 0 other notes - Text to indicate that the thread was collapsed and that there are other notes to view if tapped. - ··· %#@NOTES@ ··· ··· %#@NOTES@ ··· @@ -745,50 +736,47 @@ Part of a larger sentence to describe how many profiles a user is following. Follower + Follower Part of a larger sentence to describe how many people are following a user. Followers - Part of a larger sentence to describe how many people are following a user. - - - Followers + Followers Part of a larger sentence to describe how many people are following a user. %#@FOLLOWERS@ + %#@FOLLOWERS@ Part of a larger sentence to describe how many people are following a user. %#@REACTIONS@ + %#@REACTIONS@ Part of a larger sentence to describe how many reactions there are on a post. Reaction + Reaction Part of a larger sentence to describe how many reactions there are on a post. Reactions - Part of a larger sentence to describe how many reactions there are on a post. - - - Reactions + Reactions Part of a larger sentence to describe how many reactions there are on a post. %#@RELAYS@ + %#@RELAYS@ Part of a larger sentence to describe how many relay servers a user is connected. Relay + Relay Part of a larger sentence to describe how many relay servers a user is connected. Relays - Part of a larger sentence to describe how many relay servers a user is connected. - - - Relays + Relays Part of a larger sentence to describe how many relay servers a user is connected. @@ -797,8 +785,8 @@ Part of a larger sentence to describe how many profiles a user is following.Label to indicate that the user is replying to 1 user and others. - & 1 other - & 1 other + & %d other + & %d other Label to indicate that the user is replying to 1 user and others. @@ -817,8 +805,8 @@ Part of a larger sentence to describe how many profiles a user is following.Label to indicate that the user is replying to 2 users and others. - & 1 other - & 1 other + & %d other + & %d other Label to indicate that the user is replying to 2 users and others. @@ -833,34 +821,47 @@ Part of a larger sentence to describe how many profiles a user is following. %#@REPOSTS@ + %#@REPOSTS@ Part of a larger sentence to describe how many reposts there are. Repost + Repost Part of a larger sentence to describe how many reposts there are. Reposts + Reposts Part of a larger sentence to describe how many reposts there are. - - Reposts - Part of a larger sentence to describe how many reposts there are. + + %1$#@SATS@ + %1$#@SATS@ + Amount of sats. + + + %2$@ sat + %2$@ sat + Amount of sats. + + + %2$@ sats + %2$@ sats + Amount of sats. %#@TIPS@ + %#@TIPS@ Part of a larger sentence to describe how many tip payments there are on a post. Tip + Tip Part of a larger sentence to describe how many tip payments there are on a post. Tips - Part of a larger sentence to describe how many tip payments there are on a post. - - - Tips + Tips Part of a larger sentence to describe how many tip payments there are on a post. diff --git a/damus Localizations/es-419.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings b/damus Localizations/es-419.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings index 38e15f8aabddcc78d76f6ad1b56c5b8d738fb279..462b7249a1b58b32192121dcefc45363b202abc3 100644 GIT binary patch delta 50 zcmdn9f$`ruMyCJ&CSNd+nf!stWpfAP4d;ooG?NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - 0 other notes one - 1 other note + %d other note other %d other notes @@ -30,8 +28,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Followers one Follower other @@ -48,8 +44,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reactions one Reaction other @@ -66,8 +60,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Relays one Relay other @@ -87,7 +79,7 @@ zero one - & 1 other + & %d other other & %d others @@ -105,7 +97,7 @@ zero one - & 1 other + & %d other other & %d others @@ -120,14 +112,28 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reposts one Repost other Reposts + sats_count + + NSStringLocalizedFormatKey + %1$#@SATS@ + SATS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + @ + one + %2$@ sat + other + %2$@ sats + + tips_count NSStringLocalizedFormatKey @@ -138,8 +144,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Tips one Tip other diff --git a/damus/ContentView.swift b/damus/ContentView.swift index 755f726..8526688 100644 --- a/damus/ContentView.swift +++ b/damus/ContentView.swift @@ -172,13 +172,20 @@ struct ContentView: View { .navigationBarTitle(selected_timeline == .home ? NSLocalizedString("Home", comment: "Navigation bar title for Home view where posts and replies appear from those who the user is following.") : NSLocalizedString("Global", comment: "Navigation bar title for Global view where posts from all connected relay servers appear."), displayMode: .inline) .toolbar { ToolbarItem(placement: .principal) { - if selected_timeline == .home { + switch selected_timeline { + case .home: Image("damus-home") .resizable() .frame(width:30,height:30) .shadow(color: Color("DamusPurple"), radius: 2) - } else { - Text("Global") + case .dms: + Text("DM", comment: "Toolbar label for DM view, which is the English abbreviation for Direct Message.") + case .notifications: + Text("Notifications", comment: "Toolbar label for Notifications view.") + case .search: + Text("Global", comment: "Toolbar label for Global view where posts from all connected relay servers appear.") + case .none: + Text("", comment: "Toolbar label for unknown views. This label would be displayed only if a new timeline view is added but a toolbar label was not explicitly assigned to it yet.") } } diff --git a/damus/Models/Mentions.swift b/damus/Models/Mentions.swift index c24f315..2840b95 100644 --- a/damus/Models/Mentions.swift +++ b/damus/Models/Mentions.swift @@ -198,11 +198,7 @@ enum Amount: Equatable { let sats = NSNumber(value: (Double(amt) / 1000.0)) let formattedSats = numberFormatter.string(from: sats) ?? sats.stringValue - if formattedSats == numberFormatter.string(from: 1) { - return NSLocalizedString("\(formattedSats) sat", comment: "Amount of 1 sat.") - } - - return NSLocalizedString("\(formattedSats) sats", comment: "Amount of sats.") + return String(format: NSLocalizedString("sats_count", comment: "Amount of sats."), sats.decimalValue as NSDecimalNumber, formattedSats) } } } diff --git a/damus/en-US.lproj/Localizable.stringsdict b/damus/en-US.lproj/Localizable.stringsdict index 7289c3c..914baa7 100644 --- a/damus/en-US.lproj/Localizable.stringsdict +++ b/damus/en-US.lproj/Localizable.stringsdict @@ -12,10 +12,8 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - 0 other notes one - 1 other note + %d other note other %d other notes @@ -30,8 +28,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Followers one Follower other @@ -48,8 +44,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reactions one Reaction other @@ -66,8 +60,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Relays one Relay other @@ -87,7 +79,7 @@ zero one - & 1 other + & %d other other & %d others @@ -105,7 +97,7 @@ zero one - & 1 other + & %d other other & %d others @@ -120,14 +112,28 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Reposts one Repost other Reposts + sats_count + + NSStringLocalizedFormatKey + %1$#@SATS@ + SATS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + @ + one + %2$@ sat + other + %2$@ sats + + tips_count NSStringLocalizedFormatKey @@ -138,8 +144,6 @@ NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - Tips one Tip other diff --git a/damus/es-419.lproj/Localizable.stringsdict b/damus/es-419.lproj/Localizable.stringsdict index d09d2ff..914baa7 100644 --- a/damus/es-419.lproj/Localizable.stringsdict +++ b/damus/es-419.lproj/Localizable.stringsdict @@ -2,6 +2,70 @@ + collapsed_event_view_other_notes + + NSStringLocalizedFormatKey + ··· %#@NOTES@ ··· + NOTES + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %d other note + other + %d other notes + + + followers_count + + NSStringLocalizedFormatKey + %#@FOLLOWERS@ + FOLLOWERS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Follower + other + Followers + + + reactions_count + + NSStringLocalizedFormatKey + %#@REACTIONS@ + REACTIONS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Reaction + other + Reactions + + + relays_count + + NSStringLocalizedFormatKey + %#@RELAYS@ + RELAYS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Relay + other + Relays + + replying_to_one_and_others NSStringLocalizedFormatKey @@ -15,7 +79,7 @@ zero one - & 1 other + & %d other other & %d others @@ -33,27 +97,57 @@ zero one - & 1 other + & %d other other & %d others - collapsed_event_view_other_notes + reposts_count NSStringLocalizedFormatKey - ··· %#@NOTES@ ··· - NOTES + %#@REPOSTS@ + REPOSTS NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey d - zero - 0 other notes one - 1 other note + Repost other - %d other notes + Reposts + + + sats_count + + NSStringLocalizedFormatKey + %1$#@SATS@ + SATS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + @ + one + %2$@ sat + other + %2$@ sats + + + tips_count + + NSStringLocalizedFormatKey + %#@TIPS@ + TIPS + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + Tip + other + Tips