Is it possible to store NSLocalizesStrings in plists?
This may seem like a stupid question. But I have a plist for different categories in a iPhone application.
categories.plist
<key>cat1</key>
<string>Players</string>
...
Is it possible to localize this strings? This categories are created in to Core Data when the app is started for the first time. And if the user changes langu开发者_开发知识库age after first launch the category names will still be in the language as when the application was first launched.
Is it possible in some way to localize the strings in the plist?
You can easily localize the entire file. Just select the file in Xocde and click the + button in the Localization section of the File Inspector to add multiple languages. You can then translate the file for each language.
If you just want to translate the strings, I would put keys into the plist file and translate those keys via the normal Localizable.strings file. In your code, you would then not use the strings directly but translate them first with NSLocalizedString()
.
you would typically create a plist file for each localization (not individual keys).
since that would duplicate the categories in each localization and in many cases only the translations change (not necessarily other keys), you could work around this if you use a separate lookup table (plist) for the localized translations of the values in the category plist. then you would use the category plist keyed values as keys for another localized lookup table (which would need only strings).
精彩评论