diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj index 556a8a0b..1658f8ce 100644 --- a/damus.xcodeproj/project.pbxproj +++ b/damus.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 3A3040EF29A8FEE9008A0F29 /* EventDetailBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040EE29A8FEE9008A0F29 /* EventDetailBarTests.swift */; }; 3A3040F129A8FF97008A0F29 /* LocalizationUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040F029A8FF97008A0F29 /* LocalizationUtil.swift */; }; 3A3040F329A91366008A0F29 /* ProfileViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A3040F229A91366008A0F29 /* ProfileViewTests.swift */; }; + 3A30410129AB12AA008A0F29 /* EventGroupViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A30410029AB12AA008A0F29 /* EventGroupViewTests.swift */; }; 3A4325A82961E11400BFCD9D /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 3A4325AA2961E11400BFCD9D /* Localizable.stringsdict */; }; 3AA247FD297E3CFF0090C62D /* RepostsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA247FC297E3CFF0090C62D /* RepostsModel.swift */; }; 3AA247FF297E3D900090C62D /* RepostsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA247FE297E3D900090C62D /* RepostsView.swift */; }; @@ -282,6 +283,8 @@ 3A3040FC29A91F31008A0F29 /* zh-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-TW"; path = "zh-TW.lproj/InfoPlist.strings"; sourceTree = ""; }; 3A3040FD29A91F31008A0F29 /* zh-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-TW"; path = "zh-TW.lproj/Localizable.stringsdict"; sourceTree = ""; }; 3A3040FE29A91F31008A0F29 /* zh-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-TW"; path = "zh-TW.lproj/Localizable.strings"; sourceTree = ""; }; + 3A3040FF29AB02D1008A0F29 /* en-US */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-US"; path = "en-US.lproj/Localizable.strings"; sourceTree = ""; }; + 3A30410029AB12AA008A0F29 /* EventGroupViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventGroupViewTests.swift; sourceTree = ""; }; 3A41E559299D52BE001FA465 /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/InfoPlist.strings; sourceTree = ""; }; 3A41E55A299D52BE001FA465 /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/Localizable.strings; sourceTree = ""; }; 3A41E55B299D52BE001FA465 /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = id; path = id.lproj/Localizable.stringsdict; sourceTree = ""; }; @@ -1037,6 +1040,7 @@ 3A3040EC29A5CB86008A0F29 /* ReplyDescriptionTests.swift */, 3A3040EE29A8FEE9008A0F29 /* EventDetailBarTests.swift */, 3A3040F229A91366008A0F29 /* ProfileViewTests.swift */, + 3A30410029AB12AA008A0F29 /* EventGroupViewTests.swift */, ); path = damusTests; sourceTree = ""; @@ -1498,6 +1502,7 @@ buildActionMask = 2147483647; files = ( 3A3040ED29A5CB86008A0F29 /* ReplyDescriptionTests.swift in Sources */, + 3A30410129AB12AA008A0F29 /* EventGroupViewTests.swift in Sources */, 3ACBCB78295FE5C70037388A /* TimeAgoTests.swift in Sources */, DD597CBD2963D85A00C64D32 /* MarkdownTests.swift in Sources */, 3A3040EF29A8FEE9008A0F29 /* EventDetailBarTests.swift in Sources */, @@ -1612,6 +1617,7 @@ 3A827A19299FC69D00C4D171 /* ru */, 3A3040FA29A91EFC008A0F29 /* zh-HK */, 3A3040FE29A91F31008A0F29 /* zh-TW */, + 3A3040FF29AB02D1008A0F29 /* en-US */, ); name = Localizable.strings; sourceTree = ""; diff --git a/damus/Util/LocalizationUtil.swift b/damus/Util/LocalizationUtil.swift index de496d60..7e2aa938 100644 --- a/damus/Util/LocalizationUtil.swift +++ b/damus/Util/LocalizationUtil.swift @@ -7,13 +7,11 @@ import Foundation -func bundleForLocale(locale: Locale) -> Bundle { - let path = Bundle.main.path(forResource: locale.identifier, ofType: "lproj") +func bundleForLocale(locale: Locale?) -> Bundle { + if locale == nil { + return Bundle.main + } + + let path = Bundle.main.path(forResource: locale!.identifier, ofType: "lproj") return path != nil ? (Bundle(path: path!) ?? Bundle.main) : Bundle.main } - -func formatInt(_ int: Int) -> String { - let numberFormatter = NumberFormatter() - numberFormatter.numberStyle = .decimal - return numberFormatter.string(from: NSNumber(integerLiteral: int)) ?? "\(int)" -} diff --git a/damus/Views/ActionBar/EventDetailBar.swift b/damus/Views/ActionBar/EventDetailBar.swift index c9005855..799f0925 100644 --- a/damus/Views/ActionBar/EventDetailBar.swift +++ b/damus/Views/ActionBar/EventDetailBar.swift @@ -26,18 +26,16 @@ struct EventDetailBar: View { HStack { if bar.boosts > 0 { NavigationLink(destination: RepostsView(damus_state: state, model: RepostsModel(state: state, target: target))) { - let count = Text(verbatim: "\(formatInt(bar.boosts))").font(.body.bold()) let noun = Text(verbatim: "\(repostsCountString(bar.boosts))").foregroundColor(.gray) - Text("\(count) \(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'.") + 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'.") } .buttonStyle(PlainButtonStyle()) } if bar.likes > 0 { NavigationLink(destination: ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: target))) { - let count = Text(verbatim: "\(formatInt(bar.likes))").font(.body.bold()) let noun = Text(verbatim: "\(reactionsCountString(bar.likes))").foregroundColor(.gray) - Text("\(count) \(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'.") + 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'.") } .buttonStyle(PlainButtonStyle()) } @@ -45,9 +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 count = Text(verbatim: "\(formatInt(bar.zaps))").font(.body.bold()) let noun = Text(verbatim: "\(zapsCountString(bar.zaps))").foregroundColor(.gray) - Text("\(count) \(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'.") + 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'.") } .buttonStyle(PlainButtonStyle()) } diff --git a/damus/Views/Events/EventMenu.swift b/damus/Views/Events/EventMenu.swift index 57228d91..1669241a 100644 --- a/damus/Views/Events/EventMenu.swift +++ b/damus/Views/Events/EventMenu.swift @@ -47,9 +47,9 @@ struct EventMenuContext: View { notify(.update_bookmarks, event) } label: { let imageName = isBookmarked ? "bookmark.fill" : "bookmark" - let unBookmarkString = NSLocalizedString("Un-Bookmark", comment: "Context menu option for un-bookmarking a note") - let bookmarkString = NSLocalizedString("Bookmark", comment: "Context menu option for bookmarking a note") - Label(isBookmarked ? unBookmarkString : bookmarkString, systemImage: imageName) + let removeBookmarkString = NSLocalizedString("Remove Bookmark", comment: "Context menu option for removing a note bookmark.") + let addBookmarkString = NSLocalizedString("Add Bookmark", comment: "Context menu option for adding a note bookmark.") + Label(isBookmarked ? removeBookmarkString : addBookmarkString, systemImage: imageName) } .onAppear { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { diff --git a/damus/Views/Notifications/EventGroupView.swift b/damus/Views/Notifications/EventGroupView.swift index ee36dd1e..d2b466a3 100644 --- a/damus/Views/Notifications/EventGroupView.swift +++ b/damus/Views/Notifications/EventGroupView.swift @@ -46,62 +46,86 @@ func determine_reacting_to(our_pubkey: String, ev: NostrEvent?) -> ReactingTo { return .tagged_in } -func determine_reacting_to_text(_ r: ReactingTo) -> String { - switch r { - case .tagged_in: - return "a post you were tagged in" - case .your_post: - return "your post" - case .your_profile: - return "your profile" - } -} - func event_author_name(profiles: Profiles, _ ev: NostrEvent) -> String { let alice_pk = ev.pubkey let alice_prof = profiles.lookup(id: alice_pk) return Profile.displayName(profile: alice_prof, pubkey: alice_pk) } -func reacting_to_text(profiles: Profiles, our_pubkey: String, group: EventGroupType, ev: NostrEvent?) -> String { +/** + Returns a notification string describing user actions in response to an event group type. + + The localization keys read by this function are the following (although some keys may not actually be used in practice): + + "??" - returned when there are no events associated with the specified event group type. + + "reacted_tagged_in_1" - returned when 1 reaction occurred to a post that the current user was tagged in + "reacted_tagged_in_2" - returned when 2 reactions occurred to a post that the current user was tagged in + "reacted_tagged_in_3" - returned when 3 or more reactions occurred to a post that the current user was tagged in + "reacted_your_post_1" - returned when 1 reaction occurred to the current user's post + "reacted_your_post_2" - returned when 2 reactions occurred to the current user's post + "reacted_your_post_3" - returned when 3 or more reactions occurred to the current user's post + "reacted_your_profile_1" - returned when 1 reaction occurred to the current user's profile + "reacted_your_profile_2" - returned when 2 reactions occurred to the current user's profile + "reacted_your_profile_3" - returned when 3 or more reactions occurred to the current user's profile + + "reposted_tagged_in_1" - returned when 1 repost occurred to a post that the current user was tagged in + "reposted_tagged_in_2" - returned when 2 reposts occurred to a post that the current user was tagged in + "reposted_tagged_in_3" - returned when 3 or more reposts occurred to a post that the current user was tagged in + "reposted_your_post_1" - returned when 1 repost occurred to the current user's post + "reposted_your_post_2" - returned when 2 reposts occurred to the current user's post + "reposted_your_post_3" - returned when 3 or more reposts occurred to the current user's post + "reposted_your_profile_1" - returned when 1 repost occurred to the current user's profile + "reposted_your_profile_2" - returned when 2 reposts occurred to the current user's profile + "reposted_your_profile_3" - returned when 3 or more reposts occurred to the current user's profile + + "zapped_tagged_in_1" - returned when 1 zap occurred to a post that the current user was tagged in + "zapped_tagged_in_2" - returned when 2 zaps occurred to a post that the current user was tagged in + "zapped_tagged_in_3" - returned when 3 or more zaps occurred to a post that the current user was tagged in + "zapped_your_post_1" - returned when 1 zap occurred to the current user's post + "zapped_your_post_2" - returned when 2 zaps occurred to the current user's post + "zapped_your_post_3" - returned when 3 or more zaps occurred to the current user's post + "zapped_your_profile_1" - returned when 1 zap occurred to the current user's profile + "zapped_your_profile_2" - returned when 2 zaps occurred to the current user's profile + "zapped_your_profile_3" - returned when 3 or more zaps occurred to the current user's profile + */ +func reacting_to_text(profiles: Profiles, our_pubkey: String, group: EventGroupType, ev: NostrEvent?, locale: Locale? = nil) -> String { let verb = reacting_to_verb(group: group) - let reacting_to = determine_reacting_to(our_pubkey: our_pubkey, ev: ev) - let target = determine_reacting_to_text(reacting_to) - - if group.events.count == 1 { + let localization_key = "\(verb)_\(reacting_to)_\(min(group.events.count, 3))" + let bundle = bundleForLocale(locale: locale) + + switch group.events.count { + case 0: + return NSLocalizedString("??", comment: "") + case 1: let ev = group.events.first! let profile = profiles.lookup(id: ev.pubkey) let display_name = Profile.displayName(profile: profile, pubkey: ev.pubkey) - return String(format: "%@ is %@ %@", display_name, verb, target) - } - - if group.events.count == 2 { + + return String(format: bundle.localizedString(forKey: localization_key, value: bundleForLocale(locale: Locale(identifier: "en-US")).localizedString(forKey: localization_key, value: nil, table: nil), table: nil), locale: locale, display_name) + case 2: let alice_name = event_author_name(profiles: profiles, group.events[0]) let bob_name = event_author_name(profiles: profiles, group.events[1]) - - return String(format: "%@ and %@ are %@ %@", alice_name, bob_name, verb, target) - } - - if group.events.count > 2 { + + return String(format: bundle.localizedString(forKey: localization_key, value: bundleForLocale(locale: Locale(identifier: "en-US")).localizedString(forKey: localization_key, value: nil, table: nil), table: nil), locale: locale, alice_name, bob_name) + default: let alice_name = event_author_name(profiles: profiles, group.events.first!) let count = group.events.count - 1 - - return String(format: "%@ and %d other people are %@ %@", alice_name, count, verb, target) + + return String(format: bundle.localizedString(forKey: localization_key, value: bundleForLocale(locale: Locale(identifier: "en-US")).localizedString(forKey: localization_key, value: nil, table: nil), table: nil), locale: locale, count, alice_name) } - - return "??" } func reacting_to_verb(group: EventGroupType) -> String { switch group { case .reaction: - return "reacting" + return "reacted" case .repost: - return "reposting" + return "reposted" case .zap: fallthrough case .profile_zap: - return "zapping" + return "zapped" } } @@ -111,7 +135,7 @@ struct EventGroupView: View { let group: EventGroupType var GroupDescription: some View { - Text(reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event)) + Text(verbatim: "\(reacting_to_text(profiles: state.profiles, our_pubkey: state.pubkey, group: group, ev: event))") } func ZapIcon(_ zapgrp: ZapGroup) -> some View { @@ -168,8 +192,9 @@ struct EventGroupView: View { } let test_encoded_post = "{\"id\": \"8ba545ab96959fe0ce7db31bc10f3ac3aa5353bc4428dbf1e56a7be7062516db\",\"pubkey\": \"7e27509ccf1e297e1df164912a43406218f8bd80129424c3ef798ca3ef5c8444\",\"created_at\": 1677013417,\"kind\": 1,\"tags\": [],\"content\": \"hello\",\"sig\": \"93684f15eddf11f42afbdd81828ee9fc35350344d8650c78909099d776e9ad8d959cd5c4bff7045be3b0b255144add43d0feef97940794a1bc9c309791bebe4a\"}" -let test_repost = NostrEvent(id: "", content: test_encoded_post, pubkey: "", kind: 6, tags: [], createdAt: 1) -let test_reposts = [test_repost, test_repost] +let test_repost_1 = NostrEvent(id: "", content: test_encoded_post, pubkey: "pk1", kind: 6, tags: [], createdAt: 1) +let test_repost_2 = NostrEvent(id: "", content: test_encoded_post, pubkey: "pk2", kind: 6, tags: [], createdAt: 1) +let test_reposts = [test_repost_1, test_repost_2] let test_event_group = EventGroup(events: test_reposts) struct EventGroupView_Previews: PreviewProvider { diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift index 7fe3b55c..8e4c3272 100644 --- a/damus/Views/ProfileView.swift +++ b/damus/Views/ProfileView.swift @@ -342,9 +342,8 @@ struct ProfileView: View { .foregroundColor(.gray) } else { let followerCount = followers.count! - let count_text = Text(verbatim: "\(formatInt(followerCount))").font(.subheadline.weight(.medium)) let noun_text = Text(verbatim: "\(followersCountString(followerCount))").font(.subheadline).foregroundColor(.gray) - Text("\(count_text) \(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'.") + 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'.") } } } @@ -368,9 +367,8 @@ 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 { - let count_text = Text(verbatim: "\(formatInt(profile.following))").font(.subheadline.weight(.medium)) let noun_text = Text("Following", comment: "Text on the user profile page next to the number of accounts a user is following.").font(.subheadline).foregroundColor(.gray) - Text("\(count_text) \(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("\(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'.") } } .buttonStyle(PlainButtonStyle()) @@ -393,9 +391,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 count_text = Text(verbatim: "\(formatInt(relays.keys.count))").font(.subheadline.weight(.medium)) let noun_text = Text(verbatim: "\(relaysCountString(relays.keys.count))").font(.subheadline).foregroundColor(.gray) - let relay_text = Text("\(count_text) \(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 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'.") if profile.pubkey == damus_state.pubkey && damus_state.is_privkey_user { NavigationLink(destination: RelayConfigView(state: damus_state)) { relay_text diff --git a/damus/Views/RelayFilterView.swift b/damus/Views/RelayFilterView.swift index 8f99b5b8..d3f9efcf 100644 --- a/damus/Views/RelayFilterView.swift +++ b/damus/Views/RelayFilterView.swift @@ -26,7 +26,7 @@ struct RelayFilterView: View { } var body: some View { - Text("To filter your \(timeline.rawValue) feed, please choose applicable relays from the list below:", comment: "Instructions on how to filter a specific timeline feed by choosing relay servers to filter on.") + Text("Please choose relays from the list below to filter the current feed:", comment: "Instructions on how to filter a specific timeline feed by choosing relay servers to filter on.") .padding() .padding(.top, 20) .padding(.bottom, 0) diff --git a/damus/Views/SaveKeysView.swift b/damus/Views/SaveKeysView.swift index e2de28ab..875dc8b4 100644 --- a/damus/Views/SaveKeysView.swift +++ b/damus/Views/SaveKeysView.swift @@ -38,7 +38,7 @@ struct SaveKeysView: View { .foregroundColor(.white) .padding(.bottom, 10) - Text("This is your account ID, you can give this to your friends so that they can follow you. Click to copy.", comment: "Label to describe that a public key is the user's account ID and what they can do with it.") + Text("This is your account ID, you can give this to your friends so that they can follow you. Tap to copy.", comment: "Label to describe that a public key is the user's account ID and what they can do with it.") .foregroundColor(.white) .padding(.bottom, 10) diff --git a/damus/Views/Zaps/CustomizeZapView.swift b/damus/Views/Zaps/CustomizeZapView.swift index c20a5cbd..613ad3ee 100644 --- a/damus/Views/Zaps/CustomizeZapView.swift +++ b/damus/Views/Zaps/CustomizeZapView.swift @@ -81,16 +81,16 @@ struct CustomizeZapView: View { } var ZapTypePicker: some View { - Picker("Zap Type", selection: $zap_type) { - Text("Public").tag(ZapType.pub) - Text("Anonymous").tag(ZapType.anon) - Text("Non-Zap").tag(ZapType.non_zap) + Picker(NSLocalizedString("Zap Type", comment: "Header text to indicate that the picker below it is to choose the type of zap to send."), selection: $zap_type) { + Text("Public", comment: "Picker option to indicate that a zap should be sent publicly and identify the user as who sent it.").tag(ZapType.pub) + Text("Anonymous", comment: "Picker option to indicate that a zap should be sent anonymously and not identify the user as who sent it.").tag(ZapType.anon) + Text("Non-Zap", comment: "Picker option to indicate that sats should be sent to the user's wallet as a regular Lightning payment, not as a zap.").tag(ZapType.non_zap) } .pickerStyle(.segmented) } var AmountPicker: some View { - Picker("Zap Amount", selection: $selected_amount) { + Picker(NSLocalizedString("Zap Amount", comment: "Title of picker that allows selection of predefined amounts to zap."), selection: $selected_amount) { ForEach(zap_amounts) { entry in let fmt = format_msats_abbrev(Int64(entry.amount) * 1000) HStack(alignment: .firstTextBaseline) { @@ -156,11 +156,11 @@ struct CustomizeZapView: View { Section(content: { AmountPicker }, header: { - Text("Zap Amount in sats") + Text("Zap Amount in sats", comment: "Header text to indicate that the picker below it is to choose a pre-defined amount of sats to zap.") }) Section(content: { - TextField("100000", text: $custom_amount) + TextField(String("100000"), text: $custom_amount) .keyboardType(.numberPad) .onReceive(Just(custom_amount)) { newValue in @@ -170,27 +170,27 @@ struct CustomizeZapView: View { } } }, header: { - Text("Custom Zap Amount") + Text("Custom Zap Amount", comment: "Header text to indicate that the text field below it is to enter a custom zap amount.") }) .dismissKeyboardOnTap() Section(content: { - TextField("Awesome post!", text: $comment) + TextField(NSLocalizedString("Awesome post!", comment: "Placeholder text for a comment to send as part of a zap to the user."), text: $comment) }, header: { - Text("Comment") + Text("Comment", comment: "Header text to indicate that the text field below it is a comment that will be used to send as part of a zap to the user.") }) .dismissKeyboardOnTap() Section(content: { ZapTypePicker }, header: { - Text("Zap Type") + Text("Zap Type", comment: "Header text to indicate that the picker below it is to choose the type of zap to send.") }) if zapping { - Text("Zapping...") + Text("Zapping...", comment: "Text to indicate that the app is in the process of sending a zap.") } else { - Button("Zap") { + Button(NSLocalizedString("Zap", comment: "Button to send a zap.")) { let amount = custom_amount_sats ?? selected_amount.amount send_zap(damus_state: state, event: event, lnurl: lnurl, is_custom: true, comment: comment, amount_sats: amount, zap_type: zap_type) self.zapping = true diff --git a/damus/ar.lproj/Localizable.strings b/damus/ar.lproj/Localizable.strings index 4dc7b225..215f103f 100644 Binary files a/damus/ar.lproj/Localizable.strings and b/damus/ar.lproj/Localizable.strings differ diff --git a/damus/cs.lproj/Localizable.strings b/damus/cs.lproj/Localizable.strings index 6a8ba2d8..8e8d13af 100644 Binary files a/damus/cs.lproj/Localizable.strings and b/damus/cs.lproj/Localizable.strings differ diff --git a/damus/de.lproj/Localizable.strings b/damus/de.lproj/Localizable.strings index b0eb6fc0..f7a83a8a 100644 Binary files a/damus/de.lproj/Localizable.strings and b/damus/de.lproj/Localizable.strings differ diff --git a/damus/el-GR.lproj/Localizable.strings b/damus/el-GR.lproj/Localizable.strings index 16534267..df41af5f 100644 Binary files a/damus/el-GR.lproj/Localizable.strings and b/damus/el-GR.lproj/Localizable.strings differ diff --git a/damus/en-US.lproj/Localizable.strings b/damus/en-US.lproj/Localizable.strings new file mode 100644 index 00000000..17fd6e3e Binary files /dev/null and b/damus/en-US.lproj/Localizable.strings differ diff --git a/damus/en-US.lproj/Localizable.stringsdict b/damus/en-US.lproj/Localizable.stringsdict index 21ef04ab..53fbef3a 100644 --- a/damus/en-US.lproj/Localizable.stringsdict +++ b/damus/en-US.lproj/Localizable.stringsdict @@ -34,6 +34,54 @@ Followers + reacted_tagged_in_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to a post you were tagged in + other + %2$@ and %1$d others reacted to a post you were tagged in + + + reacted_your_post_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to your post + other + %2$@ and %1$d others reacted to your post + + + reacted_your_profile_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to your profile + other + %2$@ and %1$d others reacted to your profile + + reactions_count NSStringLocalizedFormatKey @@ -82,6 +130,54 @@ Replying to %2$@, %3$@ & %1$d others + reposted_tagged_in_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted a post you were tagged in + other + %2$@ and %1$d others reposted a post you were tagged in + + + reposted_your_post_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted your post + other + %2$@ and %1$d others reposted your post + + + reposted_your_profile_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted your profile + other + %2$@ and %1$d others reposted your profile + + reposts_count NSStringLocalizedFormatKey @@ -114,6 +210,54 @@ %2$@ sats + zapped_tagged_in_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped a post you were tagged in + other + %2$@ and %1$d others zapped a post you were tagged in + + + zapped_your_post_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped your post + other + %2$@ and %1$d others zapped your post + + + zapped_your_profile_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped your profile + other + %2$@ and %1$d others zapped your profile + + zaps_count NSStringLocalizedFormatKey diff --git a/damus/en-US.xcloc/Localized Contents/en-US.xliff b/damus/en-US.xcloc/Localized Contents/en-US.xliff index e9a01b82..ba87f69d 100644 --- a/damus/en-US.xcloc/Localized Contents/en-US.xliff +++ b/damus/en-US.xcloc/Localized Contents/en-US.xliff @@ -32,6 +32,11 @@ + + %@ + %@ + No comment provided by engineer. + %@ %@ %@ %@ @@ -58,6 +63,11 @@ 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 @@ -73,6 +83,11 @@ Sentence composed of 2 variables to describe how many people are following a use '%@' is an invalid NIP-05 identifier. It should look like an email. Description of why the nip05 identifier is invalid. + + ?? + ?? + No comment provided by engineer. + API Key (optional) API Key (optional) @@ -119,6 +134,11 @@ Sentence composed of 2 variables to describe how many people are following a use Button to add recommended relay server. Button to confirm adding user inputted relay. + + Add Bookmark + Add Bookmark + Context menu option for adding a note bookmark. + Add Relay Add Relay @@ -134,6 +154,11 @@ Sentence composed of 2 variables to describe how many people are following a use Admin Label to display relay contact user. + + Anonymous + Anonymous + Picker option to indicate that a zap should be sent anonymously and not identify the user as who sent it. + Any Any @@ -144,6 +169,11 @@ Sentence composed of 2 variables to describe how many people are following a use Are you sure you want to repost this? Alert message to ask if user wants to repost a post. + + Awesome post! + Awesome post! + Placeholder text for a comment to send as part of a zap to the user. + - - Bookmark - Bookmark - Context menu option for bookmarking a note - Bookmarks Bookmarks @@ -258,6 +283,11 @@ Sentence composed of 2 variables to describe how many people are following a use Clear Cache Section title for clearing cached data. + + Comment + Comment + Header text to indicate that the text field below it is a comment that will be used to send as part of a zap to the user. + Contact Contact @@ -354,6 +384,11 @@ Sentence composed of 2 variables to describe how many people are following a use Custom Dropdown option for selecting a custom translation server. + + Custom Zap Amount + Custom Zap Amount + Header text to indicate that the text field below it is to enter a custom zap amount. + DMs DMs @@ -632,6 +667,11 @@ Sentence composed of 2 variables to describe how many people are following a use No block list found, create a new one? This will overwrite any previous block lists. Alert message prompt that asks if the user wants to create a new block list, overwriting previous block lists. + + Non-Zap + Non-Zap + Picker option to indicate that sats should be sent to the user's wallet as a regular Lightning payment, not as a zap. + None None @@ -687,6 +727,11 @@ Sentence composed of 2 variables to describe how many people are following a use Plan Prompt selection of DeepL subscription plan to perform machine translations on notes + + Please choose relays from the list below to filter the current feed: + Please choose relays from the list below to filter the current feed: + Instructions on how to filter a specific timeline feed by choosing relay servers to filter on. + Post Post @@ -734,6 +779,11 @@ Label for filter for seeing your posts and replies (instead of only your posts). Profile Picture Label for Profile Picture section of user profile form. + + Public + Public + Picker option to indicate that a zap should be sent publicly and identify the user as who sent it. + Public Account ID Public Account ID @@ -785,6 +835,11 @@ Label for filter for seeing your posts and replies (instead of only your posts). Relays have been notified and clients will be able to use this information to filter content. Thank you! Description of what was done as a result of sending a report to relay servers. + + Remove Bookmark + Remove Bookmark + Context menu option for removing a note bookmark. + Remove all Remove all @@ -997,9 +1052,9 @@ Label for filter for seeing your posts and replies (instead of only your posts). This is an old-style nostr key. We're not sure if it's a pubkey or private key. Please toggle the button below if this a public key. Warning that the inputted account key for login is an old-style and asking user to verify if it is a public key. - - This is your account ID, you can give this to your friends so that they can follow you. Click to copy. - This is your account ID, you can give this to your friends so that they can follow you. Click to copy. + + This is your account ID, you can give this to your friends so that they can follow you. Tap to copy. + This is your account ID, you can give this to your friends so that they can follow you. Tap to copy. Label to describe that a public key is the user's account ID and what they can do with it. @@ -1012,11 +1067,6 @@ Label for filter for seeing your posts and replies (instead of only your posts). Thread Navigation bar title for note thread. - - To filter your %@ feed, please choose applicable relays from the list below: - To filter your %@ feed, please choose applicable relays from the list below: - Instructions on how to filter a specific timeline feed by choosing relay servers to filter on. - Translate Note Translate Note @@ -1052,11 +1102,6 @@ Label for filter for seeing your posts and replies (instead of only your posts). URL Example URL to LibreTranslate server - - Un-Bookmark - Un-Bookmark - Context menu option for un-bookmarking a note - Unfollow Unfollow @@ -1157,7 +1202,28 @@ Label for filter for seeing your posts and replies (instead of only your posts). Zap Zap - Accessibility label for zap button + Accessibility label for zap button + Button to send a zap. + + + Zap Amount + Zap Amount + Title of picker that allows selection of predefined amounts to zap. + + + Zap Amount in sats + Zap Amount in sats + Header text to indicate that the picker below it is to choose a pre-defined amount of sats to zap. + + + Zap Type + Zap Type + Header text to indicate that the picker below it is to choose the type of zap to send. + + + Zapping... + Zapping... + Text to indicate that the app is in the process of sending a zap. Zaps @@ -1209,6 +1275,66 @@ Label for filter for seeing your posts and replies (instead of only your posts). optional Label indicating that a form input is optional. + + %@ reacted to a post you were tagged in + %@ reacted to a post you were tagged in + Notification that a user reacted to a post that the current user was tagged in + + + %@ and %@ reacted to a post you were tagged in + %@ and %@ reacted to a post you were tagged in + Notification that 2 users reacted to a post that the current user was tagged in + + + %@ reacted to your post + %@ reacted to your post + Notification that a user reacted to the current user's post + + + %@ and %@ reacted to your post + %@ and %@ reacted to your post + Notification that 2 users reacted to the current user's profile + + + %@ reacted to your profile + %@ reacted to your profile + Notification that a user reacted to the current user's profile + + + %@ and %@ reacted to your profile + %@ and %@ reacted to your profile + Notification that 2 users reacted to the current user's profile + + + %@ reposted a post you were tagged in + %@ reposted a post you were tagged in + Notification that a user reposted a post that the current user was tagged in + + + %@ and %@ reposted a post you were tagged in + %@ and %@ reposted a post you were tagged in + Notification that 2 users reposted a post that the current user was tagged in + + + %@ reposted your post + %@ reposted your post + Notification that a user reposted the current user's post + + + %@ and %@ reposted your post + %@ and %@ reposted your post + Notification that 2 users reposted the current user's post + + + %@ reposted your profile + %@ reposted your profile + Notification that a user reposted the current user's profile + + + %@ and %@ reposted your profile + %@ and %@ reposted your profile + Notification that 2 users reposted the current user's profile + satoshi satoshi @@ -1224,6 +1350,36 @@ Label for filter for seeing your posts and replies (instead of only your posts). you You, in this context, is the person who controls their own social network. You is used in the context of a larger sentence that welcomes the reader to the social network that they control themself. + + %@ zapped a post you were tagged in + %@ zapped a post you were tagged in + Notification that a user zapped a post that the current user was tagged in + + + %@ and %@ zapped a post you were tagged in + %@ and %@ zapped a post you were tagged in + Notification that 2 users zapped a post that the current user was tagged in + + + %@ zapped your post + %@ zapped your post + Notification that a user zapped the current user's post + + + %@ and %@ zapped your post + %@ and %@ zapped your post + Notification that 2 users zapped the current user's post + + + %@ zapped your profile + %@ zapped your profile + Notification that a user zapped the current user's profile + + + %@ and %@ zapped your profile + %@ and %@ zapped your profile + Notification that 2 users zapped the current user's profile + ⚡️ %@ ⚡️ %@ @@ -1266,6 +1422,51 @@ Label for filter for seeing your posts and replies (instead of only your posts). %#@FOLLOWERS@ + + %#@REACTED@ + %#@REACTED@ + + + + %2$@ and %1$d other reacted to a post you were tagged in + %2$@ and %1$d other reacted to a post you were tagged in + + + + %2$@ and %1$d others reacted to a post you were tagged in + %2$@ and %1$d others reacted to a post you were tagged in + + + + %#@REACTED@ + %#@REACTED@ + + + + %2$@ and %1$d other reacted to your post + %2$@ and %1$d other reacted to your post + + + + %2$@ and %1$d others reacted to your post + %2$@ and %1$d others reacted to your post + + + + %#@REACTED@ + %#@REACTED@ + + + + %2$@ and %1$d other reacted to your profile + %2$@ and %1$d other reacted to your profile + + + + %2$@ and %1$d others reacted to your profile + %2$@ and %1$d others reacted to your profile + + %#@REACTIONS@ %#@REACTIONS@ @@ -1311,6 +1512,51 @@ Label for filter for seeing your posts and replies (instead of only your posts). Replying to %2$@, %3$@ & %1$d others + + %#@REPOSTED@ + %#@REPOSTED@ + + + + %2$@ and %1$d other reposted a post you were tagged in + %2$@ and %1$d other reposted a post you were tagged in + + + + %2$@ and %1$d others reposted a post you were tagged in + %2$@ and %1$d others reposted a post you were tagged in + + + + %#@REPOSTED@ + %#@REPOSTED@ + + + + %2$@ and %1$d other reposted your post + %2$@ and %1$d other reposted your post + + + + %2$@ and %1$d others reposted your post + %2$@ and %1$d others reposted your post + + + + %#@REPOSTED@ + %#@REPOSTED@ + + + + %2$@ and %1$d other reposted your profile + %2$@ and %1$d other reposted your profile + + + + %2$@ and %1$d others reposted your profile + %2$@ and %1$d others reposted your profile + + %#@REPOSTS@ %#@REPOSTS@ @@ -1341,6 +1587,51 @@ Label for filter for seeing your posts and replies (instead of only your posts). %2$@ sats + + %#@ZAPPED@ + %#@ZAPPED@ + + + + %2$@ and %1$d other zapped a post you were tagged in + %2$@ and %1$d other zapped a post you were tagged in + + + + %2$@ and %1$d others zapped a post you were tagged in + %2$@ and %1$d others zapped a post you were tagged in + + + + %#@ZAPPED@ + %#@ZAPPED@ + + + + %2$@ and %1$d other zapped your post + %2$@ and %1$d other zapped your post + + + + %2$@ and %1$d others zapped your post + %2$@ and %1$d others zapped your post + + + + %#@ZAPPED@ + %#@ZAPPED@ + + + + %2$@ and %1$d other zapped your profile + %2$@ and %1$d other zapped your profile + + + + %2$@ and %1$d others zapped your profile + %2$@ and %1$d others zapped your profile + + %#@ZAPS@ %#@ZAPS@ 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 d13f961a..10543b39 100644 Binary files a/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings and b/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.strings differ diff --git a/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.stringsdict b/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.stringsdict index 21ef04ab..53fbef3a 100644 --- a/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.stringsdict +++ b/damus/en-US.xcloc/Source Contents/damus/en-US.lproj/Localizable.stringsdict @@ -34,6 +34,54 @@ Followers + reacted_tagged_in_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to a post you were tagged in + other + %2$@ and %1$d others reacted to a post you were tagged in + + + reacted_your_post_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to your post + other + %2$@ and %1$d others reacted to your post + + + reacted_your_profile_3 + + NSStringLocalizedFormatKey + %#@REACTED@ + REACTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reacted to your profile + other + %2$@ and %1$d others reacted to your profile + + reactions_count NSStringLocalizedFormatKey @@ -82,6 +130,54 @@ Replying to %2$@, %3$@ & %1$d others + reposted_tagged_in_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted a post you were tagged in + other + %2$@ and %1$d others reposted a post you were tagged in + + + reposted_your_post_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted your post + other + %2$@ and %1$d others reposted your post + + + reposted_your_profile_3 + + NSStringLocalizedFormatKey + %#@REPOSTED@ + REPOSTED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other reposted your profile + other + %2$@ and %1$d others reposted your profile + + reposts_count NSStringLocalizedFormatKey @@ -114,6 +210,54 @@ %2$@ sats + zapped_tagged_in_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped a post you were tagged in + other + %2$@ and %1$d others zapped a post you were tagged in + + + zapped_your_post_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped your post + other + %2$@ and %1$d others zapped your post + + + zapped_your_profile_3 + + NSStringLocalizedFormatKey + %#@ZAPPED@ + ZAPPED + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + d + one + %2$@ and %1$d other zapped your profile + other + %2$@ and %1$d others zapped your profile + + zaps_count NSStringLocalizedFormatKey diff --git a/damus/es-419.lproj/Localizable.strings b/damus/es-419.lproj/Localizable.strings index 4b15a951..e426441d 100644 Binary files a/damus/es-419.lproj/Localizable.strings and b/damus/es-419.lproj/Localizable.strings differ diff --git a/damus/fa.lproj/InfoPlist.strings b/damus/fa.lproj/InfoPlist.strings new file mode 100644 index 00000000..f153d01c Binary files /dev/null and b/damus/fa.lproj/InfoPlist.strings differ diff --git a/damus/fa.lproj/Localizable.strings b/damus/fa.lproj/Localizable.strings new file mode 100644 index 00000000..1eada13b Binary files /dev/null and b/damus/fa.lproj/Localizable.strings differ diff --git a/damus/ja.lproj/Localizable.strings b/damus/ja.lproj/Localizable.strings index b2b85e53..f2f066d3 100644 Binary files a/damus/ja.lproj/Localizable.strings and b/damus/ja.lproj/Localizable.strings differ diff --git a/damus/nl.lproj/Localizable.strings b/damus/nl.lproj/Localizable.strings index 79d1271b..9f36f305 100644 Binary files a/damus/nl.lproj/Localizable.strings and b/damus/nl.lproj/Localizable.strings differ diff --git a/damus/pl-PL.lproj/Localizable.strings b/damus/pl-PL.lproj/Localizable.strings index 4bb37cd9..0358950a 100644 Binary files a/damus/pl-PL.lproj/Localizable.strings and b/damus/pl-PL.lproj/Localizable.strings differ diff --git a/damus/uk.lproj/InfoPlist.strings b/damus/uk.lproj/InfoPlist.strings new file mode 100644 index 00000000..e9a74c71 Binary files /dev/null and b/damus/uk.lproj/InfoPlist.strings differ diff --git a/damus/zh-CN.lproj/Localizable.strings b/damus/zh-CN.lproj/Localizable.strings index e62687a6..3b11b987 100644 Binary files a/damus/zh-CN.lproj/Localizable.strings and b/damus/zh-CN.lproj/Localizable.strings differ diff --git a/damusTests/EventGroupViewTests.swift b/damusTests/EventGroupViewTests.swift new file mode 100644 index 00000000..6ccdcf6c --- /dev/null +++ b/damusTests/EventGroupViewTests.swift @@ -0,0 +1,42 @@ +// +// EventGroupViewTests.swift +// damusTests +// +// Created by Terry Yiu on 2/26/23. +// + +import XCTest +@testable import damus + +final class EventGroupViewTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testReactingToText() throws { + let enUsLocale = Locale(identifier: "en-US") + let damusState = test_damus_state() + + let encodedPost = "{\"id\": \"8ba545ab96959fe0ce7db31bc10f3ac3aa5353bc4428dbf1e56a7be7062516db\",\"pubkey\": \"7e27509ccf1e297e1df164912a43406218f8bd80129424c3ef798ca3ef5c8444\",\"created_at\": 1677013417,\"kind\": 1,\"tags\": [],\"content\": \"hello\",\"sig\": \"93684f15eddf11f42afbdd81828ee9fc35350344d8650c78909099d776e9ad8d959cd5c4bff7045be3b0b255144add43d0feef97940794a1bc9c309791bebe4a\"}" + let repost1 = NostrEvent(id: "", content: encodedPost, pubkey: "pk1", kind: NostrKind.boost.rawValue, tags: [], createdAt: 1) + let repost2 = NostrEvent(id: "", content: encodedPost, pubkey: "pk2", kind: NostrKind.boost.rawValue, tags: [], createdAt: 1) + + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_event, locale: enUsLocale), "??") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_event, locale: enUsLocale), "pk1:pk1 reposted a post you were tagged in") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_event, locale: enUsLocale), "pk1:pk1 and pk2:pk2 reposted a post you were tagged in") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost2])), ev: test_event, locale: enUsLocale), "pk1:pk1 and 2 others reposted a post you were tagged in") + + Bundle.main.localizations.map { Locale(identifier: $0) }.forEach { + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_event, locale: $0), "??") + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_event, locale: $0)) + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_event, locale: $0)) + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost2])), ev: test_event, locale: $0)) + } + } + +} diff --git a/devtools/export-source-translation.sh b/devtools/export-source-translation.sh index b1a9b49f..e443317d 100755 --- a/devtools/export-source-translation.sh +++ b/devtools/export-source-translation.sh @@ -4,4 +4,4 @@ xcodebuild -exportLocalizations -project damus.xcodeproj -localizationPath "damus" -exportLanguage en-US # Generates all SwiftUI Text() wrapped localized strings. -genstrings -o "damus/en-US.xcloc/Source Contents/damus/en-US.lproj/" -SwiftUI **/*.swift +genstrings -a -d -o "damus/en-US.xcloc/Source Contents/damus/en-US.lproj/" -SwiftUI **/*.swift diff --git a/transifex.yml b/transifex.yml index ab7c9b4c..f109a5ca 100644 --- a/transifex.yml +++ b/transifex.yml @@ -4,25 +4,27 @@ git: file_format: STRINGSDICT source_file_extension: stringsdict source_language: en_US - source_file_dir: damus/en-US.xcloc/Source Contents/damus/en-US.lproj/ - translation_files_expression: damus/.lproj/ + source_file_dir: 'damus/en-US.xcloc/Source Contents/damus/en-US.lproj/' + translation_files_expression: 'damus/.lproj/' - filter_type: dir file_format: STRINGS source_file_extension: strings source_language: en_US - source_file_dir: damus/en-US.xcloc/Source Contents/damus/en-US.lproj/ - translation_files_expression: damus/.lproj/ + source_file_dir: 'damus/en-US.xcloc/Source Contents/damus/en-US.lproj/' + translation_files_expression: 'damus/.lproj/' -settings: - language_mapping: - de_AT: de-AT - el_GR: el-GR - es_419: es-419 - fr_FR: fr-FR - it_IT: it-IT - lv_LV: lv-LV - pl_PL: pl-PL - pt_PT: pt-PT - tr_TR: tr-TR - zh_CN: zh-CN + settings: + language_mapping: + en_US: en-US + el_GR: el-GR + es_419: es-419 + fr_FR: fr-FR + it_IT: it-IT + lv_LV: lv-LV + pl_PL: pl-PL + pt_PT: pt-PT + tr_TR: tr-TR + zh_CN: zh-CN + zh_HK: zh-HK + zh_TW: zh-TW \ No newline at end of file