http://www.dummies.com/programming/macintosh/how-to-localize-an-ios-app-in-swiftui/
- String Interpolation
let value = 40
struct ContentView: View {
var body: some View {
Text("bookings: \(value)")
.fontWeight(.bold)
}
}
//inside localizabble.strings "bookings: %lld" = "Buchungen: %lld";
If we have 1 value give “Key %lld” = “use %lld in any order”
if we have 2 value give key “Key %@ %lld” = “use 2 %@ %lld in any order”
2. if we don’t want to give %@ or @lld in key will have to use NSLocalizedString
like below
value = 40
Text(String(format: NSLocalizedString("bookingss:", comment: ""), value))
"bookingss:" = "Buchungen: sandesh %lld french";
3. To make variable or dynamic value localised make it LocalizedStringKey
let name: LocalizedStringKey = "name"
Text(name) //inside localizabble.strings "name" = "sandesh sardar";