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

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

问题描述

我有一个国际化的iPhone项目。在各种 $ {lang} .lproj / InfoPlist.strings 文件中,我只有一个键, CFBundleName =我的应用名称

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 文件,以及几个 InfoPlistMyApp Lite .strings lite版本的文件。但我无法弄清楚如何设置它。 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.

设置如下目录结构:

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

右键单击组和文件(左上角) 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天全站免登陆