I need to send my server a list of localizations for a particular string.
Meaning, if my app has a string Foo which is localized as @”Foo” in English and @”Фу” in Russian, I’d like to send the server a list such as this:
- String Foo:
- English: “Foo”
- Russian: “Фу”
What I think I need to be able to do is:
- Enumerate localized strings for each language my app is localized for
- Get the localized version of Foo for each language
How do I do (1) and how do I do (2)?
You can retrieve all of the string keys by reading in English.lproj/Localizable.strings as a dictionary and fetching its keys:
To get each language’s translation, you can iterate over the languages for each English key and use
NSLocalizedStringFromTableInBundle: