Alexander Zimin
Alexander Zimin

Reputation: 1710

iOS 10 and Permissions localization description

Faced interesting thing while preparing app for iOS 10. Starting from Xcode 8 you must provide description about any permission you ask in the app (https://forums.developer.apple.com/thread/49951)

Everything seems good, but what if I want localize this descriptions?

If I would place it inside InfoPlist.strings - app will continue crashing. But if I would place it in InfoPlist.strings and Info.plist - app would always take description from Info.plist, so there won't be any localization.

Maybe someone have a solution. Thanks :)

Upvotes: 43

Views: 32487

Answers (4)

brsr
brsr

Reputation: 121

Here are the steps for localizing info.plist variables

  1. create a new file named "InfoPlist.strings" under your project .string

  2. click on your project to open settings (if target is your app, select project by just clicking it in opened window) add any necessary languages under "localizations"

  3. go to your InfoPlist.strings file and mark checkbox of desired languages under localizations. (Press "utilities" button unless localizations is not visible after clicking on .strings file, which is at the top right corner of xcode - the rightmost one) localize

  4. add necessary "key" = "value" pairs for all localization languages in InfoPlist.strings. If you have difficulties in finding keys belonging to info.plist rows, just right click on your info.plist and select Open As -> Source Code, all row parameters are indicated as keys in source code

Upvotes: 11

Faizal Malik
Faizal Malik

Reputation: 317

enter image description here

enter image description here

Steps to Implement the localization for Permission.

Step 1 - Click the Info.plist

Step 2 - Click the Localize button [Xcode right middle]

Step 3 - Tick the languages

Upvotes: 9

Werner Kratochwil
Werner Kratochwil

Reputation: 382

I had a similar issue, it was caused by using the wrong file name:

InfoPList.strings

instead of

InfoPlist.strings

Hope this info might be of useful for someone.

Upvotes: 3

Martin Polak
Martin Polak

Reputation: 1248

I faced the same issue and I was able to resolve it because I noticed that the InfoPlist.strings wasn't member of any target.

So setting the Target Membership on the file (which puts it into the Copy Bundle Resources build phase) fixed it.


And for anyone googling here: https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html

Scroll down to "Localizing Property List Values"

Upvotes: 52

Related Questions