How to localize permission description string?

What's the problem?

My app requests location access and for that I need to provide a description for the user to read so that it is clear why we need this permission. I'm using the latest solution suggested by XCode for my app localization which is using Localizable.xcstrings file. But for the permission description, I'm adding the text to Targets -> Info -> Custom iOS Target Properties -> "Privacy - Location Always and When In Use Usage Description". I understand that the default language is English in this list so I provided it, but now I want this description to be translated to other languages so that my users can read it in their preferred language.

What I have tried so far?

I tried adding translation to the keys "INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription" and "NSLocationAlwaysAndWhenInUseUsageDescription" in my "Localizable.xcstrings" but it is always showing the description in English

Answered by Developer Tools Engineer in 814774022

Hello, To localize Info plist keys, you'll need an InfoPlist.xcstrings file in that target. When the file is named that, Xcode should automatically insert localizable keys from your Info.plist + build settings.

Accepted Answer

Hello, To localize Info plist keys, you'll need an InfoPlist.xcstrings file in that target. When the file is named that, Xcode should automatically insert localizable keys from your Info.plist + build settings.

I've created a String catalog named "InfoPlist.xcstrings" and built the project. XCode recognized it and added all the strings that need translations. I've added the translations and it all worked well.

How to localize permission description string?
 
 
Q