Reputation: 131
In my iOS project, I am having multiple targets for building several slightly different apps. It is required for each app to have its own localised name. How can I achieve this? I have tried to localise the Info.plist but failed.
Upvotes: 2
Views: 1797
Reputation: 2935
To localize the value of an Info.plist key we need to add an InfoPlist.strings file to the project. We can do that in the usual way by right-clicking on the Resources group and selecting “Add -> New File…” and choosing the Strings file template from Resource section. Give the new file the name InfoPlist.strings and ensure it is added to the current target:
Before we localise the file we can add the default values for the English locale. We will add values for both the CFBundleDisplayName and CFBundleName keys though for iOS the important one is the bundle display name:
"CFBundleDisplayName" = "Hello";
"CFBundleName" = "Hello";
To localise the file, click on it at the "Identity and Type” panel and click the “Localize..” button, after that you can add the localisation language you want as below:
For different targets, remember not change the file name of "InfoPlist.strings", still use the same name for all the targets, but put them to different folders.
Upvotes: 0
Reputation: 48514
You can go to 'Build Settings' and pick the name of your Info.plist File (INFOPLIST_FILE
) for each target, independently.
You can also use different InfoPlist.strings
.
Use InfoPlist.strings
in your xx.lproj (for example en.lproj)
Add the following line in InfoPlist.strings
:
/* Application Name on the Springboard */
"CFBundleDisplayName" = "my app";
Upvotes: 2