Internationalize all bundled user-facing strings
Enables localization to non-English locales in the future
This commit is contained in:
@@ -401,7 +401,7 @@ func reply_desc(profiles: Profiles, event: NostrEvent) -> String {
|
||||
let n = desc.others
|
||||
|
||||
if desc.pubkeys.count == 0 {
|
||||
return "Reply to self"
|
||||
return NSLocalizedString("Reply to self", comment: "Label to indicate that the user is replying to themself.")
|
||||
}
|
||||
|
||||
let names: [String] = pubkeys.map {
|
||||
@@ -411,20 +411,14 @@ func reply_desc(profiles: Profiles, event: NostrEvent) -> String {
|
||||
|
||||
if names.count == 2 {
|
||||
if n > 2 {
|
||||
let and_other = reply_others_desc(n: n, n_pubkeys: pubkeys.count)
|
||||
return "Replying to \(names[0]), \(names[1])\(and_other)"
|
||||
let othersCount = n - pubkeys.count
|
||||
return String(format: NSLocalizedString("replying_to_two_and_others", comment: "Label to indicate that the user is replying to 2 users and others."), othersCount, names[0], names[1])
|
||||
}
|
||||
return "Replying to \(names[0]) & \(names[1])"
|
||||
return String.localizedStringWithFormat("Replying to %@ & %@", names[0], names[1])
|
||||
}
|
||||
|
||||
let and_other = reply_others_desc(n: n, n_pubkeys: pubkeys.count)
|
||||
return "Replying to \(names[0])\(and_other)"
|
||||
}
|
||||
|
||||
func reply_others_desc(n: Int, n_pubkeys: Int) -> String {
|
||||
let other = n - n_pubkeys
|
||||
let plural = other == 1 ? "" : "s"
|
||||
return n > 1 ? " & \(other) other\(plural)" : ""
|
||||
let othersCount = n - pubkeys.count
|
||||
return String(format: NSLocalizedString("replying_to_one_and_others", comment: "Label to indicate that the user is replying to 1 user and others."), othersCount, names[0])
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user