From 440ef02eaad8ed97979fd3ba8e2c12d20c8b68af Mon Sep 17 00:00:00 2001 From: Terry Yiu <963907+tyiu@users.noreply.github.com> Date: Fri, 5 May 2023 00:05:06 -0400 Subject: [PATCH] Update reaction notification title and miscellaneous localization fixes --- damus/Models/HomeModel.swift | 4 ++-- damus/Views/ActionBar/EventDetailBar.swift | 12 ++++++------ .../Views/Notifications/EventGroupView.swift | 2 +- damus/Views/Profile/ProfileView.swift | 10 +++++----- damus/Views/PubkeyView.swift | 2 +- .../Localized Contents/en-US.xliff | 17 ++++++----------- .../damus/en-US.lproj/Localizable.strings | Bin 82966 -> 82710 bytes 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift index 3fcce786..8e21cb68 100644 --- a/damus/Models/HomeModel.swift +++ b/damus/Models/HomeModel.swift @@ -1153,10 +1153,10 @@ func create_local_notification(profiles: Profiles, notify: LocalNotification) { title = String(format: NSLocalizedString("Reposted by %@", comment: "Reposted by heading in local notification"), displayName) identifier = "myBoostNotification" case .like: - title = String(format: NSLocalizedString("Reacted by %@", comment: "Reacted by heading in local notification"), displayName) + title = String(format: NSLocalizedString("%@ reacted with %@", comment: "Reacted by heading in local notification"), displayName, notify.event.content) identifier = "myLikeNotification" case .dm: - title = String(format: NSLocalizedString("%@", comment: "DM by heading in local notification"), displayName) + title = displayName identifier = "myDMNotification" case .zap: // not handled here diff --git a/damus/Views/ActionBar/EventDetailBar.swift b/damus/Views/ActionBar/EventDetailBar.swift index a1c72fc3..00e9edcc 100644 --- a/damus/Views/ActionBar/EventDetailBar.swift +++ b/damus/Views/ActionBar/EventDetailBar.swift @@ -26,16 +26,16 @@ struct EventDetailBar: View { HStack { if bar.boosts > 0 { NavigationLink(destination: RepostsView(damus_state: state, model: RepostsModel(state: state, target: target))) { - let noun = Text(verbatim: "\(repostsCountString(bar.boosts))").foregroundColor(.gray) - Text("\(Text("\(bar.boosts)").font(.body.bold())) \(noun)", 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'.") + let noun = Text(verbatim: repostsCountString(bar.boosts)).foregroundColor(.gray) + Text("\(Text(verbatim: bar.boosts.formatted()).font(.body.bold())) \(noun)", 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 && !state.settings.onlyzaps_mode { NavigationLink(destination: ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: target))) { - let noun = Text(verbatim: "\(reactionsCountString(bar.likes))").foregroundColor(.gray) - Text("\(Text("\(bar.likes)").font(.body.bold())) \(noun)", 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'.") + let noun = Text(verbatim: reactionsCountString(bar.likes)).foregroundColor(.gray) + Text("\(Text(verbatim: bar.likes.formatted()).font(.body.bold())) \(noun)", 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()) } @@ -43,8 +43,8 @@ struct EventDetailBar: View { if bar.zaps > 0 { let dst = ZapsView(state: state, target: .note(id: target, author: target_pk)) NavigationLink(destination: dst) { - let noun = Text(verbatim: "\(zapsCountString(bar.zaps))").foregroundColor(.gray) - Text("\(Text("\(bar.zaps)").font(.body.bold())) \(noun)", 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'.") + let noun = Text(verbatim: zapsCountString(bar.zaps)).foregroundColor(.gray) + Text("\(Text(verbatim: bar.zaps.formatted()).font(.body.bold())) \(noun)", 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/Notifications/EventGroupView.swift b/damus/Views/Notifications/EventGroupView.swift index 63aae03d..26f10508 100644 --- a/damus/Views/Notifications/EventGroupView.swift +++ b/damus/Views/Notifications/EventGroupView.swift @@ -174,7 +174,7 @@ struct EventGroupView: View { return VStack(alignment: .center) { Image(systemName: "bolt.fill") .foregroundColor(.orange) - Text("\(fmt)") + Text(verbatim: fmt) .foregroundColor(Color.orange) } } diff --git a/damus/Views/Profile/ProfileView.swift b/damus/Views/Profile/ProfileView.swift index ec6dcd40..7f02b80b 100644 --- a/damus/Views/Profile/ProfileView.swift +++ b/damus/Views/Profile/ProfileView.swift @@ -362,8 +362,8 @@ struct ProfileView: View { .foregroundColor(.gray) } else { let followerCount = followers.count! - let noun_text = Text(verbatim: "\(followersCountString(followerCount))").font(.subheadline).foregroundColor(.gray) - Text("\(Text("\(followerCount)").font(.subheadline.weight(.medium))) \(noun_text)", 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'.") + let noun_text = Text(verbatim: followersCountString(followerCount)).font(.subheadline).foregroundColor(.gray) + Text("\(Text(verbatim: followerCount.formatted()).font(.subheadline.weight(.medium))) \(noun_text)", 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'.") } } } @@ -388,7 +388,7 @@ struct ProfileView: View { NavigationLink(destination: FollowingView(damus_state: damus_state, following: following_model, whos: profile.pubkey)) { HStack { let noun_text = Text(verbatim: "\(followingCountString(profile.following))").font(.subheadline).foregroundColor(.gray) - Text("\(Text("\(profile.following)").font(.subheadline.weight(.medium))) \(noun_text)", 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(verbatim: profile.following.formatted()).font(.subheadline.weight(.medium))) \(noun_text)", 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()) @@ -411,8 +411,8 @@ 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 noun_text = Text(verbatim: "\(relaysCountString(relays.keys.count))").font(.subheadline).foregroundColor(.gray) - let relay_text = Text("\(Text("\(relays.keys.count)").font(.subheadline.weight(.medium))) \(noun_text)", 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 noun_text = Text(verbatim: relaysCountString(relays.keys.count)).font(.subheadline).foregroundColor(.gray) + let relay_text = Text("\(Text(verbatim: relays.keys.count.formatted()).font(.subheadline.weight(.medium))) \(noun_text)", 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 diff --git a/damus/Views/PubkeyView.swift b/damus/Views/PubkeyView.swift index 7b333b29..748110d6 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(verbatim: "\(abbrev_pubkey(pubkey))") + Text(verbatim: abbrev_pubkey(pubkey)) .foregroundColor(color) } } diff --git a/damus/en-US.xcloc/Localized Contents/en-US.xliff b/damus/en-US.xcloc/Localized Contents/en-US.xliff index 27c179be..075a6466 100644 --- a/damus/en-US.xcloc/Localized Contents/en-US.xliff +++ b/damus/en-US.xcloc/Localized Contents/en-US.xliff @@ -45,7 +45,7 @@ %@ %@ - DM by heading in local notification + No comment provided by engineer. %@ %@ @@ -63,6 +63,11 @@ Sentence composed of 2 variables to describe how many people are following a use %@ not found When a note or profile is not found when searching for it via its note id + + %1$@ reacted with %2$@ + %1$@ reacted with %2$@ + Reacted by heading in local notification + %@. Creating an account doesn't require a phone number, email or name. Get started right away with zero friction. %@. Creating an account doesn't require a phone number, email or name. Get started right away with zero friction. @@ -78,11 +83,6 @@ Sentence composed of 2 variables to describe how many people are following a use %@. 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 - No comment provided by engineer. - %lld/%lld %lld/%lld @@ -983,11 +983,6 @@ Button text to indicate that the zap type is a private zap. Quote Button to compose a quoted note - - Reacted by %@ - Reacted by %@ - Reacted by heading in local notification - Reactions Reactions diff --git a/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings b/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings index cecf0fdd94c400137f78b4f4ce6b1a468bc1ca48..b09f5c21a7cba68488a464f9175a5f353202d998 100644 GIT binary patch delta 129 zcmbQ%!8)ytb;A~+$!t1alUalnCJXFinJgolv3Zq}9rNZ6*#(T7U#RLZPL@z8*{mWz zi-}QTa;=8=lbM8NCil(bnXaJ0D75*5Obg@W3o06uCnzaxZjk5T znC#%kGMPgc>oKG;n+DP_n-xXYbdW&z#3xkG)%y2&MSQIo5#aZO(IN{%^^ UA$jurSE7^S=JIS-xb`gv0P3Dvy#N3J