问题描述
我有一个具有不同Localizable.string文件的项目:
I have a project with different Localizable.string files:
../zh-CN.lproj/Localizable.strings
../en-GB.lproj /Localizable.strings
../zh-CN.lproj/Localizable.strings
../en-US.lproj /Localizable.strings
../fr-FR.lproj/Localizable.strings
../fr-FR.lproj /Localizable.strings
../fr-CH.lproj/Localizable.strings
../fr-CH.lproj /Localizable.strings
等...大约有10种不同的语言.全部都是UTF16编码的.我使用XCode4.当我在fr-FR中配置测试iPod并启动我的应用程序时,该行如下:
etc... with about 10 different languages. All are UTF16 encoded. I use XCode4. When I configure my test iPod in fr-FR and launch my app the line:
NSLog(@"Current Locale: %@", [[NSLocale currentLocale] localeIdentifier]);
返回:当前语言环境:fr_FR
returns: Current Locale: fr_FR
但是我所有的NSLocalizedString(@"my_string",nil)始终返回位于我的葡萄牙语可本地化的值.这个问题有什么线索吗?
But all my NSLocalizedString(@"my_string",nil) always return the values located in my Portugese localizable. Any clue for that problem?
推荐答案
不知道这是否适用于您,但是我已经注意到使用ShareKit遇到类似的问题.这本身不是ShareKit的问题,但是问题涉及与我的重叠的库中的localizable.strings文件(例如,我有2个针对英语的localizable.strings.一个是我的,另一个是用于sharekit的).
Not sure if this applies to you, but i have noticed similar problems using ShareKit. It wasn't ShareKit's problem per se, but the problem involved localizable.strings files inside the library that overlapped mine (for example, I had 2 localizable.strings for the english language. One was mine, the other one was for sharekit).
该应用程序正在运行,发现很难决定应从这两个localizable.strings文件中选择哪个来绘制字符串.
The app was running, and was finding it difficult to decide which of the two localizable.strings file should it choose to draw strings from.
解决方案是将所有字符串传输到一个文件中,然后删除重复文件.
The solution was transferring all strings in one file end deleting the duplicate files, of course.
希望我能帮上忙.
这篇关于iPhone使用了错误的Localizable.strings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!