Fix localization issues, add tests, import translations, and add zh-CN and zh-TW
Closes: #689
This commit is contained in:
@@ -48,7 +48,7 @@ struct EventMenuContext: View {
|
||||
} 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 optoin for bookmarking a note")
|
||||
let bookmarkString = NSLocalizedString("Bookmark", comment: "Context menu option for bookmarking a note")
|
||||
Label(isBookmarked ? unBookmarkString : bookmarkString, systemImage: imageName)
|
||||
}
|
||||
.onAppear {
|
||||
|
||||
@@ -26,13 +26,15 @@ struct ReplyDescription_Previews: PreviewProvider {
|
||||
}
|
||||
}
|
||||
|
||||
func reply_desc(profiles: Profiles, event: NostrEvent) -> String {
|
||||
func reply_desc(profiles: Profiles, event: NostrEvent, locale: Locale = Locale.current) -> String {
|
||||
let desc = make_reply_description(event.tags)
|
||||
let pubkeys = desc.pubkeys
|
||||
let n = desc.others
|
||||
|
||||
let bundle = bundleForLocale(locale: locale)
|
||||
|
||||
if desc.pubkeys.count == 0 {
|
||||
return NSLocalizedString("Replying to self", comment: "Label to indicate that the user is replying to themself.")
|
||||
return NSLocalizedString("Replying to self", bundle: bundle, comment: "Label to indicate that the user is replying to themself.")
|
||||
}
|
||||
|
||||
let names: [String] = pubkeys.map {
|
||||
@@ -40,20 +42,16 @@ func reply_desc(profiles: Profiles, event: NostrEvent) -> String {
|
||||
return Profile.displayName(profile: prof, pubkey: $0)
|
||||
}
|
||||
|
||||
let othersCount = n - pubkeys.count
|
||||
if names.count > 1 {
|
||||
let othersCount = n - pubkeys.count
|
||||
if othersCount == 0 {
|
||||
return String(format: "Replying to %@ & %@", names[0], names[1])
|
||||
return String(format: NSLocalizedString("Replying to %@ & %@", bundle: bundle, comment: "Label to indicate that the user is replying to 2 users."), locale: locale, names[0], names[1])
|
||||
} else {
|
||||
return String(format: "Replying to %@, %@ & %d others", names[0], names[1], othersCount)
|
||||
return String(format: bundle.localizedString(forKey: "replying_to_two_and_others", value: nil, table: nil), locale: locale, othersCount, names[0], names[1])
|
||||
}
|
||||
}
|
||||
|
||||
if othersCount == 0 {
|
||||
return String(format: "Replying to %@", names[0])
|
||||
} else {
|
||||
return String(format: "Replying to %@ & %d others", names[0], othersCount)
|
||||
}
|
||||
return String(format: NSLocalizedString("Replying to %@", bundle: bundle, comment: "Label to indicate that the user is replying to 1 user."), locale: locale, names[0])
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user