i am working on app using SwiftUI in Xcode, and i want to localise it, but i have an issue. I already done all steps from youtube video
- Added localizations in Project -> info -> localizations
- Created 2 localization files
- Filled it like "hll" = "Hello"; etc.
and when i build an app i have only keys instead values (hll instead Hello), so i tried Text("hll") and Text(LocalizedStringKey("hll")). What am i missing?
CodePudding user response:
Make sure you have the Localizable.strings file in your project. There is where LocalizedStringKey looks for the keys/values as a default.
https://developer.apple.com/documentation/swiftui/localizedstringkey
If you want to define a different file use the
Text(LocalizedStringKey, tableName: String?, bundle: Bundle?, comment: StaticString?)
initializer and the tableName should match your .strings file name.
