commit 440ef02eaad8ed97979fd3ba8e2c12d20c8b68af
parent 9a0ad7bcab447f80c3b6c120a23baed2a5087d09
Author: Terry Yiu <963907+tyiu@users.noreply.github.com>
Date:   Fri,  5 May 2023 00:05:06 -0400
Update reaction notification title and miscellaneous localization fixes
Diffstat:
7 files changed, 21 insertions(+), 26 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -45,7 +45,7 @@
       <trans-unit id="%@" xml:space="preserve">
         <source>%@</source>
         <target>%@</target>
-        <note>DM by heading in local notification</note>
+        <note>No comment provided by engineer.</note>
       </trans-unit>
       <trans-unit id="%@ %@" xml:space="preserve">
         <source>%@ %@</source>
@@ -63,6 +63,11 @@ Sentence composed of 2 variables to describe how many people are following a use
         <target>%@ not found</target>
         <note>When a note or profile is not found when searching for it via its note id</note>
       </trans-unit>
+      <trans-unit id="%@ reacted with %@" xml:space="preserve">
+        <source>%1$@ reacted with %2$@</source>
+        <target>%1$@ reacted with %2$@</target>
+        <note>Reacted by heading in local notification</note>
+      </trans-unit>
       <trans-unit id="%@. Creating an account doesn't require a phone number, email or name. Get started right away with zero friction." xml:space="preserve">
         <source>%@. Creating an account doesn't require a phone number, email or name. Get started right away with zero friction.</source>
         <target>%@. Creating an account doesn't require a phone number, email or name. Get started right away with zero friction.</target>
@@ -78,11 +83,6 @@ Sentence composed of 2 variables to describe how many people are following a use
         <target>%@. Tip your friend's posts and stack sats with Bitcoin⚡️, the native currency of the internet.</target>
         <note>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.</note>
       </trans-unit>
-      <trans-unit id="%lld" xml:space="preserve">
-        <source>%lld</source>
-        <target>%lld</target>
-        <note>No comment provided by engineer.</note>
-      </trans-unit>
       <trans-unit id="%lld/%lld" xml:space="preserve">
         <source>%lld/%lld</source>
         <target>%lld/%lld</target>
@@ -983,11 +983,6 @@ Button text to indicate that the zap type is a private zap.</note>
         <target>Quote</target>
         <note>Button to compose a quoted note</note>
       </trans-unit>
-      <trans-unit id="Reacted by %@" xml:space="preserve">
-        <source>Reacted by %@</source>
-        <target>Reacted by %@</target>
-        <note>Reacted by heading in local notification</note>
-      </trans-unit>
       <trans-unit id="Reactions" xml:space="preserve">
         <source>Reactions</source>
         <target>Reactions</target>
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
Binary files differ.