XCode - 多个目标,多个*国际化*名称? [英] XCode - Multiple targets, Multiple *internationalized* names?

查看:16
本文介绍了XCode - 多个目标,多个*国际化*名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个国际化的 iPhone 项目.在各种 ${lang}.lproj/InfoPlist.strings 文件中,我只有一个键,CFBundleName = "My App Name".

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.

我想要几个翻译后的 InfoPlistMyApp.strings 文件用于主要目标,以及几个 InfoPlistMyAppLite.strings 文件用于精简版.但我不知道如何设置它.InfoPlist.strings 名称似乎一成不变,所以我无法动态替换它.

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.

有什么想法吗?

推荐答案

事实证明这很容易,但很费力.您可以有多个 InfoPlist.strings,每个目标启用一个,并且它们每个都可以国际化,只要每个集合位于不同的 Xcode 组中.

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  <-- ...
            ...

将这些文件导入 Xcode 组,如下所示:

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

右键单击Groups & Files"(Xcode 的左上角)并确保Target Membership"可见,然后检查您的目标,检查是否为每个目标启用了正确的字符串集.

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.

这篇关于XCode - 多个目标,多个*国际化*名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆