I need to localize two keys of info.plist: NSLocationUsageDescription
and NSCameraUsageDescription
. So I tried to create a new file called InfoPlist.strings and then I localized it, but app always shows strings stored in info.plist file. What's wrong?
Official documentation from Information Property List Key Reference
Localized values are not stored in the Info.plist file itself. Instead, you store the values for a particular localization in a strings file with the name InfoPlist.strings. You place this file in the same language-specific project directory that you use to store other resources for the same localization. The contents of the InfoPlist.strings file are the individual keys you want localized and the appropriately translated value. The routines that look up key values in the Info.plist file take the user’s language preferences into account and return the localized version of the key (from the appropriate InfoPlist.strings file) when one exists. If a localized version of a key does not exist, the routines return the value stored in the Info.plist file.
My InfoPlist.strings file:
NSCameraUsageDescription = "hello";
NSLocationUsageDescription = "hello hello";
The file needs to be inside of a directory indicating the language, for example en.lproj