Can anybody help me? I can\'t find any description of the localization in Swift UI. Can anyone please give advice or better an example of how to localize for example T
There is a thing you can do wrong that's not made very clear in any explanation I've seen. It turns out that Text("hello") is only interpreted as a localization key if you pass it a literal. If you pass a variable of type String, this doesn't happen. The answer is instead to declare the variable as type LocalizedStringKey.
Text("hello") //-> implicitly treats string literal as a key; looks up and displays "Hello World!"
let cap1:String = "hello"
Text(cap1) //-> no lookup for explicit String variable; just displays "hello"
let cap2:LocalizedStringKey = "hello"
Text(cap2) //-> looks up explicit LocalizedStringKey value; displays "Hello World!"