35

I localized Info.plist :

enter image description here

And I got this build error :

error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist': 
The file “Info.plist” couldn’t be opened because there is no such file.

Actually there are now two Info.plist files :

fr.lproj/Info.plist
Base.lproj/Info.plist

How to localize the Info.plist path ?

Cherif
  • 5,223
  • 8
  • 33
  • 54
  • 2
    Check path of info.plist file in build settings – Samir Jun 22 '15 at 11:01
  • It used to work before localization. After localization there are two Info.plist files. What key-value pair I should change in build settings ? – Cherif Jun 22 '15 at 11:07
  • May be you require to change build settings, I got this kind of issue once when I have moved my info.plist file to another folder. At that time I just used to clean build and clean derived data folder. Cross check that, Is info.plist moved to another folder? and Also check path in Build settings for "info.plist File" key in Targets->Packaging. Generally Its MyProjectName/Info.plist – Samir Jun 22 '15 at 11:14
  • 1
    @Samir I edited the question, there are actually tow Info.plist now, and I guess Xcode is supposed to choose the right one, regarding the langage. How to tell him to do that ? – Cherif Jun 22 '15 at 11:20
  • For localization purpose there should be infoplist.strings file for different languages. I haven't use multiple Info.plist file for localization. – Samir Jun 22 '15 at 11:38
  • 1
    To localize info.plist file you can check this http://stackoverflow.com/questions/25736700/how-to-localise-a-string-inside-the-ios-info-plist-file – Samir Jun 22 '15 at 11:42

2 Answers2

39

Roll back those changes, add a InfoPlist.strings file to your project, localize it and then add the needed keys to it. For example:

"CFBundleDisplayName" = "App display name";
"CFBundleName" = "App bundle name";
ncerezo
  • 1,331
  • 12
  • 11
  • 1
    "CFBundleName" is also on .plist or only on .strings file? – rr1g0 Feb 22 '17 at 20:35
  • @rr1g0 , On both files – Husam Sep 25 '17 at 11:04
  • 5
    For anyone finding this answer a bit cryptic, check out this https://stackoverflow.com/questions/25736700/how-to-localise-a-string-inside-the-ios-info-plist-file and the official documentation https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html – James Y Feb 27 '18 at 19:08
11

To localized Info.plist :

  1. Find in the x-code the folder Resources (is placed in root)
  2. Select the folder Resources
  3. Then press the main menu File->New->File...
  4. Select in section "Resource" Strings File and press Next
  5. Then in Save As field write InfoPlist ONLY ("I" capital and "P" capital)
  6. Then press Create
  7. Then select the file InfoPlist.strings that created in Resources folder and press in the right menu the button "Localize"
  8. Then you Select the Project from the Project Navigator and select the The project from project list
  9. In the info tab at the bottom you can as many as language you want (There is in section Localizations)
  10. The language you can see in Resources Folder
  11. To localize the values ("key") from info.plist file you can open with a text editor and get all the keys you want to localize
  12. You write any key as the example in any InfoPlist.strings like the above example

"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";

"NSLocationAlwaysUsageDescription"="blabla2";

That's all work and you have localize your info.plist file!

Costas Bakoulias
  • 895
  • 9
  • 11