As you might know the iOS 8 requires NSLocationWhenInUseUsageDescription key for using user\'s location. I have added this key and some gen
Step by step localize Info.plist:
Save As
field write InfoPlist ONLY ("I" capital and "P" capital)"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";
"NSLocationAlwaysUsageDescription"="blabla2";
That's all work and you have localize your info.plist file!
As RGML say, you can create an InfoPlist.strings, localize it then add your key and the value like this: "NSLocationWhenInUseUsageDescription" = "Help To locate me!";
It will add the key to your info.plist for the specified language.
In addition to the accepted answer (the project is on Flutter but it's basically the same as native):
I do have folders Base.lproj
, en.lproj
, xx.kproj.
etc. with InfoPlist.strings
in each.
This file has lines like this (no quotes around the key and with a semicolon at the end):
NSLocationWhenInUseUsageDescription = "My explanation why I need this";
Check that you have your languages in your YourProject > Info:
Also, check the project.pbxproj
file, it is in XXX.xcodeproj/project.pbxproj:
it should have all your languages in codes (en, fr, etc.)
But even then it didn't work. Finally, I noticed the CFBundleLocalizations
key in the Info.plist
file. (to open it as raw key-values in XCode - right mouse button on the Info.plist
file -> Open As -> Source Code)
Make sure that the values in array are codes rather than complete words, for example fr
instead of French
etc.
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ru</string>
<string>lv</string>
</array>
And double-check that your device is set to the language you're testing. Cheers
P.S. "Development Language" doesn't affect your issue, don't bother changing it.
When using InfoPlist.strings
file (in XCode it should be placed next to Info.plist
file - real file location can be anywhere within the project probably
) be careful to use the key's short name for the translation.
I was trying to use Privacy - Camera Usage Description
, but the working key is NSCameraUsageDescription
All the above did not work for me (XCode 7.3) so I read Apple reference on how to do, and it is much simpler than described above. According to Apple:
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.
Accordingly, I created a string file named InfoPlist.strings and placed it in the xx.lproj folder of the "xx" language (and added it to the project using File->Add Files to ...). That's it. No need for the key "Localized resources can be mixed" = YES, and no need for InfoPlist.strings in base.lproj or en.lproj.
The application uses the Info.plist key-value as the default value if it can not find a key in the language specific file. Thus, I put my English value in the Info.plist file and the translated one in the language specific file, tested and everything works.
In particular, there is no need to localize the InfoPlist.strings (which creates a version of the file in the base.lproj, en.lroj, and xx.lproj), and in my case going that way did not work.
In my case the localization not worked cause of '-' symbol in the name. Example: "aero-Info.plist" And localized files: "aero-InfoPlist.strings" and "aeroInfoPlist.strings" did not work.