Localizing Property List Values

You may want to provide localized versions of strings that are provided by the plist file for your app.

This could be

  • The App Title
  • Permission requests etc

Create a language folder

The first step is to create a language folder for the language, or languages, you want to provide localization for. The folder name has the form <language code>.lproj. The language code is the the two-letter ISO 639-1 standard (preferred) or the three-letter ISO 639-2 standard code for the language. You can find a list of these codes here.

As example we will create a German folder so we name it de.lproj.

Create an InfoPlist.strings file

The next step is to create an InfoPlist.strings file in the de.lproj folder.

Add any plist strings you want to localize in the form

<plist key>=<localized value>;

For example to localize the app name you would use

CFBundleDisplayName="Übersetzter Name";

Include the de.lproj folder

To include the localized strings add the de.lproj folder to the Copy Files pane of the Standalone Application Settings.

Build and test the standalone

If you are testing on a device with the language set to German the localized app name will show on the app icon and when the app name is shown, for example in a permission request.

6 Comments

Syky

OMG, that even the final screenshot is wrong.... LOL

Elanor Buchanan

Hi Syky, thanks for your comment.

I have updated the lesson with a different example, localizing the app name instead of a permission request message.

Elanor

trevix

Just to make things clear:
- The name of the file inside the "de.lproj" folder is "InfoPlist.string" or "InfoPlist.strings" ?
- the plist strings you want to localize is
CFBundleDisplayName="Übersetzter Name"
OR
CFBundleDisplayNameÜbersetzter Name

I tried both versions for NSBluetoothPeripheralUsageDescription, but to no avail...
Can you put some more examples? Thanks

trevix

Also...what happens if there is "info.plist" file in the copy pane, for different reasons?

trevix

I've got this from apple, after having implemented the language for bluetooth:
We identified one or more issues with a recent delivery for your app, "XXX" 0.8.5 (20). Please correct the following issues, then upload again.

ITMS-90038: Malformed InfoPlist.strings file: '${filePath}'
My "InfoPlist.strings" file contains:
NSBluetoothPeripheralUsageDescription="Questa App richiede l'accesso a Bluetooth,per utilizzare pulsanti hardware esterni";
NSBluetoothAlwaysUsageDescription="Questa App richiede l'accesso a Bluetooth,per utilizzare pulsanti hardware esterni":

Elanor Buchanan

Hi Trevix

The name of the file should be InfoPlist.strings. I have corrected this in the lesson.

The InfoPlist.strings will work in combination with an included info.plist file as it only provides a list of localizations to be used in the app for permission dialogs etc.

It looks like your strings just have one typo, there is a : at the end rather than a ;

I hope that helps.

Elanor

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.