我知道这篇文章似乎重复了....但我已经研究过但没有找到答案...请帮助我。
我有一个应用程序翻译成两种语言(葡萄牙语和英语),我的字符串和 Storyboard是葡萄牙语,例如:
[[self labelTest] setText:NSLocalizedString(@"Essa é uma label", nil)];
我的资源中有文件:en.lproj/Localizable.strings
和 pt.lproj/Localizable.strings
本地化本地开发区域设置为“en”。
我在这里的理解是,如果用户语言是英语,则加载 en.lproj,何时加载葡萄牙语 pt.lproj,何时加载法语或任何其他语言。应该加载 en.lproj,但事实并非如此。如果我在我的设备中设置为西类牙语、法语或任何其他语言,我会看到葡萄牙语,我想显示英语。
这是我看过的帖子,但仍然失败:
iOS App default Language "en" is not applied
AppStore language description and "Localization native development region"
What is the meaning of "Localization native development region" entry in info.plist?
http://useyourloaf.com/blog/2010/05/10/fixing-xcode-default-development-region.html
当找不到用户设备语言的 Localizable.strings 时,我必须做什么才能始终以英语加载语言?
最佳答案
我已经检查了您的链接,其中一个链接中已经报告了这一点,但请确保我想提及这一点。
根据苹果 Property List Key Reference您可以通过 CFBundleDevelopmentRegion 设置默认语言:
CFBundleDevelopmentRegion (String - iOS, OS X)
specifies the native region for the bundle. This key contains a string value that usually corresponds to the native language of the person who wrote the bundle. The language specified by this value is used as the default language if a resource cannot be located for the user’s preferred region or language.
这当然只有在您的语言项目设置正确的情况下才有效。因此,请检查信息 选项卡
中的项目设置
中是否列出了这两种语言,并且您的资源是否已正确复制(Copy Bundle Resources
)
关于ios - localizable.string 不存在时如何设置默认语言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24377002/