Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode - Multiple targets, Multiple *internationalized* names?

Tags:

I've got an internationalized iPhone project. In the various ${lang}.lproj/InfoPlist.strings files I've got a single key, CFBundleName = "My App Name".

That's working fine for a single target, but I can't make it work for multiple targets.

I'd like to have several translated InfoPlistMyApp.strings files for the main target, plus several InfoPlistMyAppLite.strings files for the lite version. But I can't figure out how to set it up. The InfoPlist.strings name seems to be set in stone, so I can't replace it dynamically.

Any ideas?

like image 538
Kris Jenkins Avatar asked Nov 27 '09 08:11

Kris Jenkins


People also ask

How do I select target in Xcode?

Go to project's settings in the Project Navigator panel. Under the Targets sections, right click the existing target and select Duplicate to copy your existing target. 2. Xcode will ask you if your new target is for iPad development.

How do I add a target device to Xcode?

Add a New Target to Your Project To add a new target: Choose File > New > Target. Select the platform for the new target. Choose a starting template.

What are targets in Xcode?

A Target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.


1 Answers

Turns out this is quite easy, if laborious. You can have several InfoPlist.strings, one-enabled-per-target, and they can each be internationalized, as long as each set is in a different Xcode group.

Set up a directory structure like this:

.../AppName/             en.lproj/InfoPlist.strings  <-- Contains CFBundleDisplayName             it.lproj/InfoPlist.strings  <-- ...             ... .../AppNameLite/             en.lproj/InfoPlist.strings  <-- ...             it.lproj/InfoPlist.strings  <-- ...             ... 

Import those files into Xcode groups, so it looks like this:

alt text

Right-click "Groups & Files" (top left of Xcode) and make sure "Target Membership" is visible, then go through your targets, checking the the right set of strings is enabled for each.

like image 52
Kris Jenkins Avatar answered Oct 01 '22 18:10

Kris Jenkins