开发者

iPhone wrong Localizable.strings used

开发者 https://www.devze.com 2023-02-20 14:13 出处:网络
I have a project with different Localizable.string files: ../en-GB.lproj /Localizable.strings ../en-US.lproj

I have a project with different Localizable.string files:

../en-GB.lproj /Localizable.strings

../en-US.lproj /Localizable.strings

../fr-FR.lproj /Localizable.strings

../fr-CH.lproj /Localizable.strings

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 c开发者_如何学运维urrentLocale] localeIdentifier]);

returns: Current Locale: fr_FR

But all my NSLocalizedString(@"my_string",nil) always return the values located in my Portugese localizable. Any clue for that problem?


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

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.

I hope I helped.


Firstly check your Scheme Options. You might have changed the "Application Region" which in above case maybe set to "Portugal". This should be set to "System Region" and "Application Language" to "System Language"


Make sure that you're dragging the localized files to their right folder. It's pretty easy to put in the wrong place.

Have a look here for the complete list of what you should do, including screenshots of where you should drag the translations in the project tree:

http://www.icanlocalize.com/site/tutorials/iphone-applications-localization-guide/


Try doing a clean and remove the app off the device/simulator and rebuild/deploy.

I have run into issues when adding new localisations and the device caching the app resources.

Also when I localise I tend to use the country code as the name for the .lproj folder eg.:

en.lproj fr.lproj

0

精彩评论

暂无评论...
验证码 换一张
取 消