Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

iphone - XCode - Multiple targets, Multiple *internationalized* names?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...