iPhone:本地化/国际化默认字符串文件 [英] iPhone: localization / internationalization default strings file
问题描述
我目前有两种受支持的语言:英语和西班牙语。因此,对于每种语言,我有两个 main.strings
文件。一个在 en.lproj
和一个在 es.lproj
。
I currently have two supported languages: English and Spanish. Thus I have two main.strings
files for each language. One in en.lproj
and one in es.lproj
.
我现在想要的是,如果一个用户具有 en $ c>之外的语言环境,那么英语
main.strings
$ c>或 es
到达应用程序,例如 de
或 fr
。
What I want now is that the English main.strings
is the default file if a user with a locale other than en
or es
arrives at the application, e.g. de
or fr
.
它手动为代码中的每个字符串 defaultString
参数:
I know I can set it manually for each string in the code with the defaultString
parameter:
NSLocalizedStringWithDefaultValue(key, @"main",[NSBundle mainBundle], defaultString, comment);
但我不希望再次输入(并且必须在两个地方更改)而是将 en
main.strings
文件作为任何其他不支持区域设置的默认值。
But I would prefer to not enter it there again (and have to change it at two places), but rather have the en
main.strings
file as a default for any other "unsupported" locale.
推荐答案
我现在想要的是,英语
main.strings是默认文件,如果
具有除en或es
之外的语言环境的用户到达应用程序,例如de或
fr。
What I want now is that the English main.strings is the default file if a user with a locale other than en or es arrives at the application, e.g. de or fr.
您尝试过吗?我几乎肯定应用程序将回到英语区域设置,而不做任何事情。即使系统对话框也会显示为英文,除非您的应用程序明确支持当前语言环境。
Did you try that? I’m almost certain the application will fall back to the English locale without you doing anything at all. Even the system dialogs will come up in English unless your application explicitly supports the current locale.
这篇关于iPhone:本地化/国际化默认字符串文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!