开发者

Internationalization: Only key name is displayed instead of localized string in Simulator

Localization is working for other languages except of English pretty well. Every time I compile my app I see the key name instead of the localized string. Example:

NSLocalizedString(@"WelcomeKey", @"")

In Localizable.strings I have the corresponding entry:

"WelcomeKey" = "Welcome";

In the simulator I always get the key name WelcomeKey instead of Welcome. On the device this is working perfectly. In the simulator not!

I also found out that my EN Localizable.strings file was full of "???????" symbols. So I put in the old values and saved it in Xcode. I also added an entry manually instead of using genstrings. In the simulator the second language also works perfectly. Only English seems to make a problem. Perhaps I deleted English.lproj and created a EN.lproj folder?

I tried to:

  1. Empty Cache
  2. Clean all targets
  3. Delete "User/xxx/Library/Application Support/iPhone Simulator/User" folder
  4. Restart Mac
  5. Convert to UTF-16
  6. Created new Localizable.strings for EN
  7. Delete EN.lproj folder and files. Made localization completely new.

What I'm missing? I thi开发者_高级运维nk the simulator hates English ...

Edit:

So I tried to compile this App on another Mac. There it works without problems in the simulator! So either it is a setting in Xcode or a cache problem.


So you have to remove your application from iPhone/iPhone simulator first.

Press and hold on your mouse on an app in the simulator until it starts wiggling. Then hit the X. It will delete. Then press the home button to make the buttons stop wiggling.


Make sure your Localizable.strings encoding is UTF-16.


I also had the Localizable.strings full of gibberish, it helped to save the file as UTF-8.


The only option worked to me is Reset the simulator Content and Settings in iOS Simulator menu.


1 - Try deleting and rebuilding the project.

OR

2 - Go to Localizable.strings file inspector and uncheck from target membership. Build using these settings once and than remove this build. Now go back to Localizable.string file inspector menu and add target membership.

OR

3 - You might have multiple localizable.strings(e.g sharekit) in your project. Try unchecking target membership for other localizable.strings.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜