Trying to localize a SwiftUI app, I was under the impression that things had gotten a lot simpler.
I created the Localizable.strings
files for both of my supported languages, but I can't populate them with the usual Terminal genstring command : genstrings -o en.lproj *.swift
, even though I am launching this command from the correct directory.
Does anyone know if genstring is broken in swiftUI or if there is another way ? Would HATE to have to go through the hundred strings in my app...
I did find many articles online about localization in SwiftUI, but nothing that clearly explains it.
My understanding is that in SwiftUI, we can simply write things like
Text("A text to be displayed")
and this would be understood as a LocalizedStringKey
by default.
Am I wrong ?
Added Screenshot of issue after trying @Asperi's solution :