From 355cd1283c7bcf66baa7593acf50b28ed699cfcd Mon Sep 17 00:00:00 2001 From: Terry Yiu <963907+tyiu@users.noreply.github.com> Date: Wed, 15 Feb 2023 10:44:44 -0500 Subject: [PATCH] Wrap non-translatable strings so that they do not get exported --- damus/Components/ZapButton.swift | 2 +- damus/Views/ActionBar/EventActionBar.swift | 6 +-- damus/Views/ActionBar/EventDetailBar.swift | 6 +-- damus/Views/ChatView.swift | 4 +- damus/Views/ConfigView.swift | 4 +- damus/Views/CreateAccountView.swift | 4 +- damus/Views/EventDetailView.swift | 2 +- damus/Views/Events/ReplyDescription.swift | 2 +- damus/Views/Events/SelectedEventView.swift | 2 +- damus/Views/Events/TextEvent.swift | 2 +- damus/Views/MentionView.swift | 2 +- damus/Views/PowView.swift | 2 +- damus/Views/ProfileView.swift | 6 +-- damus/Views/PubkeyView.swift | 2 +- .../Views/Relays/Detail/RelayPaidDetail.swift | 2 +- .../Localized Contents/en-US.xliff | 44 +++--------------- .../damus/en-US.lproj/Localizable.strings | Bin 34500 -> 34608 bytes 17 files changed, 31 insertions(+), 61 deletions(-) diff --git a/damus/Components/ZapButton.swift b/damus/Components/ZapButton.swift index 7d5363b1..4b45efea 100644 --- a/damus/Components/ZapButton.swift +++ b/damus/Components/ZapButton.swift @@ -110,7 +110,7 @@ struct ZapButton: View { } .accessibilityLabel(NSLocalizedString("Zap", comment: "Accessibility label for zap button")) - Text("\(bar.zap_total > 0 ? "\(format_msats_abbrev(bar.zap_total))" : "")") + Text(String("\(bar.zap_total > 0 ? "\(format_msats_abbrev(bar.zap_total))" : "")")) .offset(x: 22) .font(.footnote) .foregroundColor(bar.zapped ? Color.orange : Color.gray) diff --git a/damus/Views/ActionBar/EventActionBar.swift b/damus/Views/ActionBar/EventActionBar.swift index 1852b918..96700ad5 100644 --- a/damus/Views/ActionBar/EventActionBar.swift +++ b/damus/Views/ActionBar/EventActionBar.swift @@ -61,7 +61,7 @@ struct EventActionBar: View { } } .accessibilityLabel(NSLocalizedString("Boosts", comment: "Accessibility label for boosts button")) - Text("\(bar.boosts > 0 ? "\(bar.boosts)" : "")") + Text(String("\(bar.boosts > 0 ? "\(bar.boosts)" : "")")) .offset(x: 18) .font(.footnote.weight(.medium)) .foregroundColor(bar.boosted ? Color.green : Color.gray) @@ -76,7 +76,7 @@ struct EventActionBar: View { send_like() } } - Text("\(bar.likes > 0 ? "\(bar.likes)" : "")") + Text(String("\(bar.likes > 0 ? "\(bar.likes)" : "")")) .offset(x: 22) .font(.footnote.weight(.medium)) .foregroundColor(bar.liked ? Color.accentColor : Color.gray) @@ -158,7 +158,7 @@ struct EventActionBar: View { func EventActionButton(img: String, col: Color?, action: @escaping () -> ()) -> some View { Button(action: action) { - Label(NSLocalizedString("\u{00A0}", comment: "Non-breaking space character to fill in blank space next to event action button icons."), systemImage: img) + Label(String("\u{00A0}"), systemImage: img) .font(.footnote.weight(.medium)) .foregroundColor(col == nil ? Color.gray : col!) } diff --git a/damus/Views/ActionBar/EventDetailBar.swift b/damus/Views/ActionBar/EventDetailBar.swift index be9227e6..820c9819 100644 --- a/damus/Views/ActionBar/EventDetailBar.swift +++ b/damus/Views/ActionBar/EventDetailBar.swift @@ -26,14 +26,14 @@ struct EventDetailBar: View { HStack { if bar.boosts > 0 { NavigationLink(destination: RepostsView(damus_state: state, model: RepostsModel(state: state, target: target))) { - Text("\(Text("\(bar.boosts)", comment: "Number of reposts.").font(.body.bold())) \(Text(String(format: NSLocalizedString("reposts_count", comment: "Part of a larger sentence to describe how many reposts there are."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reposts. In source English, the first variable is the number of reposts, and the second variable is 'Repost' or 'Reposts'.") + Text("\(Text(String("\(bar.boosts)")).font(.body.bold())) \(Text(String(format: NSLocalizedString("reposts_count", comment: "Part of a larger sentence to describe how many reposts there are."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reposts. In source English, the first variable is the number of reposts, and the second variable is 'Repost' or 'Reposts'.") } .buttonStyle(PlainButtonStyle()) } if bar.likes > 0 { NavigationLink(destination: ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: target))) { - Text("\(Text("\(bar.likes)", comment: "Number of reactions on a post.").font(.body.bold())) \(Text(String(format: NSLocalizedString("reactions_count", comment: "Part of a larger sentence to describe how many reactions there are on a post."), bar.likes)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reactions there are on a post. In source English, the first variable is the number of reactions, and the second variable is 'Reaction' or 'Reactions'.") + Text("\(Text(String("\(bar.likes)")).font(.body.bold())) \(Text(String(format: NSLocalizedString("reactions_count", comment: "Part of a larger sentence to describe how many reactions there are on a post."), bar.likes)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many reactions there are on a post. In source English, the first variable is the number of reactions, and the second variable is 'Reaction' or 'Reactions'.") } .buttonStyle(PlainButtonStyle()) } @@ -41,7 +41,7 @@ struct EventDetailBar: View { if bar.zaps > 0 { let dst = ZapsView(state: state, target: .note(id: target, author: target_pk)) NavigationLink(destination: dst) { - Text("\(Text("\(bar.zaps)", comment: "Number of zap payments on a post.").font(.body.bold())) \(Text(String(format: NSLocalizedString("zaps_count", comment: "Part of a larger sentence to describe how many zap payments there are on a post."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many zap payments there are on a post. In source English, the first variable is the number of zap payments, and the second variable is 'Zap' or 'Zaps'.") + Text("\(Text(String("\(bar.zaps)")).font(.body.bold())) \(Text(String(format: NSLocalizedString("zaps_count", comment: "Part of a larger sentence to describe how many zap payments there are on a post."), bar.boosts)).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many zap payments there are on a post. In source English, the first variable is the number of zap payments, and the second variable is 'Zap' or 'Zaps'.") } .buttonStyle(PlainButtonStyle()) } diff --git a/damus/Views/ChatView.swift b/damus/Views/ChatView.swift index 1dc85cb7..8b519984 100644 --- a/damus/Views/ChatView.swift +++ b/damus/Views/ChatView.swift @@ -63,7 +63,7 @@ struct ChatView: View { } var ReplyDescription: some View { - Text("\(reply_desc(profiles: damus_state.profiles, event: event))") + Text(String("\(reply_desc(profiles: damus_state.profiles, event: event))")) .font(.footnote) .foregroundColor(.gray) .frame(alignment: .leading) @@ -89,7 +89,7 @@ struct ChatView: View { ProfileName(pubkey: event.pubkey, profile: damus_state.profiles.lookup(id: event.pubkey), damus: damus_state, show_friend_confirmed: true) .foregroundColor(colorScheme == .dark ? id_to_color(event.pubkey) : Color.black) //.shadow(color: Color.black, radius: 2) - Text("\(format_relative_time(event.created_at))") + Text(String("\(format_relative_time(event.created_at))")) .foregroundColor(.gray) } } diff --git a/damus/Views/ConfigView.swift b/damus/Views/ConfigView.swift index 225d48d7..bb2c5615 100644 --- a/damus/Views/ConfigView.swift +++ b/damus/Views/ConfigView.swift @@ -130,7 +130,7 @@ struct ConfigView: View { Section(NSLocalizedString("Default Zap Amount in sats", comment: "Section title for zap configuration")) { - TextField("1000", text: $default_zap_amount) + TextField(String("1000"), text: $default_zap_amount) } Section(NSLocalizedString("Translations", comment: "Section title for selecting the translation service.")) { @@ -204,7 +204,7 @@ struct ConfigView: View { let bundleShortVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String let bundleVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as! String Section(NSLocalizedString("Version", comment: "Section title for displaying the version number of the Damus app.")) { - Text("\(bundleShortVersion) (\(bundleVersion))", comment: "Text indicating which version of the Damus app is running. Should typically not need to be translated.") + Text(String("\(bundleShortVersion) (\(bundleVersion))")) } } } diff --git a/damus/Views/CreateAccountView.swift b/damus/Views/CreateAccountView.swift index dd14533d..3505ad8c 100644 --- a/damus/Views/CreateAccountView.swift +++ b/damus/Views/CreateAccountView.swift @@ -36,14 +36,14 @@ struct CreateAccountView: View { HStack(alignment: .top) { VStack { - Text(" ", comment: "Blank space to separate profile picture from profile editor form.") + Text(String(" ")) .foregroundColor(.white) } VStack { SignupForm { FormLabel(NSLocalizedString("Username", comment: "Label to prompt username entry.")) HStack(spacing: 0.0) { - Text("@", comment: "Prefix character to username.") + Text(String("@")) .foregroundColor(.white) .padding(.leading, -25.0) diff --git a/damus/Views/EventDetailView.swift b/damus/Views/EventDetailView.swift index 46a2a09a..9960e487 100644 --- a/damus/Views/EventDetailView.swift +++ b/damus/Views/EventDetailView.swift @@ -10,7 +10,7 @@ import SwiftUI struct EventDetailView: View { var body: some View { - Text("EventDetailView") + Text(String("EventDetailView")) } } diff --git a/damus/Views/Events/ReplyDescription.swift b/damus/Views/Events/ReplyDescription.swift index 873bce7e..70d8b3ba 100644 --- a/damus/Views/Events/ReplyDescription.swift +++ b/damus/Views/Events/ReplyDescription.swift @@ -13,7 +13,7 @@ struct ReplyDescription: View { let profiles: Profiles var body: some View { - Text("\(reply_desc(profiles: profiles, event: event))") + Text(String("\(reply_desc(profiles: profiles, event: event))")) .font(.footnote) .foregroundColor(.gray) .frame(maxWidth: .infinity, alignment: .leading) diff --git a/damus/Views/Events/SelectedEventView.swift b/damus/Views/Events/SelectedEventView.swift index a4cf4648..242a63d8 100644 --- a/damus/Views/Events/SelectedEventView.swift +++ b/damus/Views/Events/SelectedEventView.swift @@ -35,7 +35,7 @@ struct SelectedEventView: View { BuilderEventView(damus: damus, event_id: mention.ref.id) } - Text("\(format_date(event.created_at))") + Text(String("\(format_date(event.created_at))")) .padding(.top, 10) .font(.footnote) .foregroundColor(.gray) diff --git a/damus/Views/Events/TextEvent.swift b/damus/Views/Events/TextEvent.swift index 3b281c06..14046097 100644 --- a/damus/Views/Events/TextEvent.swift +++ b/damus/Views/Events/TextEvent.swift @@ -33,7 +33,7 @@ struct TextEvent: View { HStack(alignment: .center) { EventProfileName(pubkey: pubkey, profile: profile, damus: damus, show_friend_confirmed: true, size: .normal) - Text("\(format_relative_time(event.created_at))") + Text(String("\(format_relative_time(event.created_at))")) .foregroundColor(.gray) Spacer() diff --git a/damus/Views/MentionView.swift b/damus/Views/MentionView.swift index baedd474..e8e8fc50 100644 --- a/damus/Views/MentionView.swift +++ b/damus/Views/MentionView.swift @@ -17,7 +17,7 @@ struct MentionView: View { let pk = bech32_pubkey(mention.ref.ref_id) ?? mention.ref.ref_id PubkeyView(pubkey: pk, relay: mention.ref.relay_id) case .event: - Text("< e >", comment: "Placeholder for event mention.") + Text(String("< e >")) //EventBlockView(pubkey: mention.ref.ref_id, relay: mention.ref.relay_id) } } diff --git a/damus/Views/PowView.swift b/damus/Views/PowView.swift index 5f445f62..2f56c7b9 100644 --- a/damus/Views/PowView.swift +++ b/damus/Views/PowView.swift @@ -11,7 +11,7 @@ import SwiftUI func PowView(_ mpow: Int?) -> some View { let pow = mpow ?? 0 - return Text("\(pow)") + return Text(String("\(pow)")) .font(.callout) .foregroundColor(calculate_pow_color(pow)) } diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift index b68baedf..ea56174f 100644 --- a/damus/Views/ProfileView.swift +++ b/damus/Views/ProfileView.swift @@ -300,7 +300,7 @@ struct ProfileView: View { let following_model = FollowingModel(damus_state: damus_state, contacts: contacts) NavigationLink(destination: FollowingView(damus_state: damus_state, following: following_model, whos: profile.pubkey)) { HStack { - Text("\(Text("\(profile.following)", comment: "Number of profiles a user is following.").font(.subheadline.weight(.medium))) \(Text("Following", comment: "Part of a larger sentence to describe how many profiles a user is following.").font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many profiles a user is following. In source English, the first variable is the number of profiles being followed, and the second variable is 'Following'.") + Text("\(Text(String("\(profile.following)")).font(.subheadline.weight(.medium))) \(Text("Following", comment: "Part of a larger sentence to describe how many profiles a user is following.").font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many profiles a user is following. In source English, the first variable is the number of profiles being followed, and the second variable is 'Following'.") } } .buttonStyle(PlainButtonStyle()) @@ -323,7 +323,7 @@ struct ProfileView: View { if let relays = profile.relays { // Only open relay config view if the user is logged in with private key and they are looking at their own profile. - let relay_text = Text("\(Text("\(relays.keys.count)", comment: "Number of relay servers a user is connected.").font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("relays_count", comment: "Part of a larger sentence to describe how many relay servers a user is connected."), relays.keys.count)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many relay servers a user is connected. In source English, the first variable is the number of relay servers, and the second variable is 'Relay' or 'Relays'.") + let relay_text = Text("\(Text(String("\(relays.keys.count)")).font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("relays_count", comment: "Part of a larger sentence to describe how many relay servers a user is connected."), relays.keys.count)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many relay servers a user is connected. In source English, the first variable is the number of relay servers, and the second variable is 'Relay' or 'Relays'.") if profile.pubkey == damus_state.pubkey && damus_state.is_privkey_user { NavigationLink(destination: RelayConfigView(state: damus_state)) { relay_text @@ -353,7 +353,7 @@ struct ProfileView: View { .foregroundColor(.gray) } else { let followerCount = followers.count! - Text("\(Text("\(followerCount)", comment: "Number of people following a user.").font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("followers_count", comment: "Part of a larger sentence to describe how many people are following a user."), followerCount)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many people are following a user. In source English, the first variable is the number of followers, and the second variable is 'Follower' or 'Followers'.") + Text("\(Text(String("\(followerCount)")).font(.subheadline.weight(.medium))) \(Text(String(format: NSLocalizedString("followers_count", comment: "Part of a larger sentence to describe how many people are following a user."), followerCount)).font(.subheadline).foregroundColor(.gray))", comment: "Sentence composed of 2 variables to describe how many people are following a user. In source English, the first variable is the number of followers, and the second variable is 'Follower' or 'Followers'.") } } } diff --git a/damus/Views/PubkeyView.swift b/damus/Views/PubkeyView.swift index 47fcb955..beb835db 100644 --- a/damus/Views/PubkeyView.swift +++ b/damus/Views/PubkeyView.swift @@ -14,7 +14,7 @@ struct PubkeyView: View { var body: some View { let color: Color = id_to_color(pubkey) ZStack { - Text("\(abbrev_pubkey(pubkey))", comment: "Abbreviated version of a nostr public key.") + Text(String("\(abbrev_pubkey(pubkey))")) .foregroundColor(color) } } diff --git a/damus/Views/Relays/Detail/RelayPaidDetail.swift b/damus/Views/Relays/Detail/RelayPaidDetail.swift index 4d83d161..53f57517 100644 --- a/damus/Views/Relays/Detail/RelayPaidDetail.swift +++ b/damus/Views/Relays/Detail/RelayPaidDetail.swift @@ -19,7 +19,7 @@ struct RelayPaidDetail: View { Button(action: { openURL(url) }, label: { - Text("\(url)") + Text(String("\(url)")) }) } } diff --git a/translations/en-US.xcloc/Localized Contents/en-US.xliff b/translations/en-US.xcloc/Localized Contents/en-US.xliff index a537b7fc..053fff85 100644 --- a/translations/en-US.xcloc/Localized Contents/en-US.xliff +++ b/translations/en-US.xcloc/Localized Contents/en-US.xliff @@ -32,16 +32,6 @@ - - - - Blank space to separate profile picture from profile editor form. - - - %@ - %@ - Abbreviated version of a nostr public key. - %@ %@ %@ %@ @@ -68,12 +58,6 @@ Sentence composed of 2 variables to describe how many relay servers a user is co %@. Tip your friend's posts and stack sats with Bitcoin⚡️, the native currency of the internet. Explanation of what can be done by users to earn money. There is a heading that precedes this explanation which is a variable to this string. - - %lld - %lld - Number of reposts. -Number of relay servers a user is connected. - %lld/%lld %lld/%lld @@ -99,16 +83,6 @@ Number of relay servers a user is connected. (who) following Navigation bar title for view that shows who a user is following. - - < e > - < e > - Placeholder for event mention. - - - @ - @ - Prefix character to username. - API Key (optional) API Key (optional) @@ -395,6 +369,11 @@ Number of relay servers a user is connected. Default Wallet Button to pay a Lightning invoice with the user's default Lightning wallet. + + Default Zap Amount in sats + Default Zap Amount in sats + Section title for zap configuration + Delete Delete @@ -468,11 +447,6 @@ Number of relay servers a user is connected. Error: %@ Error message indicating why saving keys failed. - - EventDetailView - EventDetailView - No comment provided by engineer. - Filter Filter @@ -1110,7 +1084,8 @@ Part of a larger sentence to describe how many profiles a user is following. Version Version - Label to display relay software version. + Label to display relay software version. + Section title for displaying the version number of the Damus app. Wallet @@ -1262,11 +1237,6 @@ Part of a larger sentence to describe how many profiles a user is following.sats_count Amount of sats. (Key in .stringsdict) - - u{00A0} - u{00A0} - Non-breaking space character to fill in blank space next to event action button icons. - wss://some.relay.com wss://some.relay.com diff --git a/translations/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings b/translations/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings index a6c9380310a903d7e05709103a058233b3eb473d..5f196723a6a0d533f3549f3ef752a52a49e62f18 100644 GIT binary patch delta 250 zcmX@o%e0}7X~PVr$r~btCdbwAP4?m9*u0K;kILjdbtDgoKHK&-?-vhK+b+2tn(ICE@n z(3lf4d5WeUXC~0V0-)uIlNTxo+m->HQv?*r1X>QVG7sp4T!tjDr~*(d4JcN^kOAZ? W04+}h%9R3DD}WtcuvxNpH75Y1raFlL delta 273 zcmdnc$8@BZX~PVrdOwDIhCBvch9rg}hE#?`hHQpRAU~Z!fuWe80LV`UiYfrf3?RD* z%r60o6amFbfI1Zz(tzr7fKUOfPXTC74p3Dd&>U0~@_@Q3fO=s1QW?sCB6$g5A&@mC zKm$Nd0U1#W