testing
testing

Reputation: 20279

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

Upvotes: 5

Views: 2565

Answers (5)

running70
running70

Reputation: 31

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.

Upvotes: 0

Tomamais
Tomamais

Reputation: 95

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

Upvotes: 0

zoul
zoul

Reputation: 104065

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

Upvotes: 0

testing
testing

Reputation: 20279

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.

Upvotes: 2

diederikh
diederikh

Reputation: 25271

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

Upvotes: 0

Related Questions