Vyachaslav Gerchicov
Vyachaslav Gerchicov

Reputation: 2457

Localize info.plist file which has a different name?

Currently I have a project with a lot of targets and each of them has its own "info.plist" file with its own name specified in settings:

Build Settings >> Packaging >> Info.plist File

Yes, I have read some topics similar to this one. It works when I have "Info.plist" file with this exact name (of course, I can't have ~10 files with the same name due to some reasons).

How to solve this issue?

Upvotes: 4

Views: 1810

Answers (1)

Vaibhav Misra
Vaibhav Misra

Reputation: 471

I faced the same issue today and it took me almost a whole day to fix it. I read a lot of questions related to this on stackoverflow and found out that whatever name you give your Info.Plist file (lets say InfoTarget1.plist), when it's built, it is converted to standard "Info.plist" inside product.

Surprisingly, this doesn't happen for the corresponding InfoPlist.strings file (with custom name, lets say, InfoTarget1Plist.strings).

Work around for it is to create a single InfoPlist.strings and localize it for the required languages. This worked for me since I only wanted to localize 'NSLocationAlwaysUsageDescription' for all targets.

Hence, if you only have common fields from among your plist files that you want localize, you can follow the same approach as below:

  1. Create a new InfoPlist.strings file in your folder where .plist are saved.
  2. Add the key-value pairs to localize.
  3. Localize this file from File Inspector on right side in your xcode.
  4. It will ask you to move your current InfoPlist.strings file, select 'Base' from the drop down.
  5. Select other languages you want to localize in from the File Inspector, assuming you have already added those languages in localization for your project from Info tab.
  6. Update the localized values in corresponding files.

Clean and Run your app. This should do it!

Upvotes: 4

Related Questions