views:

44

answers:

3

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.

A: 

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

Diederik Hoogenboom
How can I look after the encoding format? I created the file using File > New File > Under "Mac OS X" in "Other" choose "Empty File". How to change the encoding?
testing
Save As... in TextEdit. You can choose an encoding for plain text files.
Diederik Hoogenboom
Thanks, but that didn't solved the problem ...
testing
When you look at the resources folder in your generated app (in the Build folder), is the Localizable.strings file located in the English.lproj folder? I am asking this because the file has to be make localizable from Xcode (Get info on the file and choose Make file Localizable)
Diederik Hoogenboom
Where is the resources folder? In the build folder I have many folders, but I cannot find a resources folder. Localizable.strings is located in EN.lproj and in Xcode the file is made localizable.
testing
I again see reversed question marks. The file is now in UTF-16, but Xcode shows me the wrong encoding ...
testing
I created the file for EN new (with genstrings). Now I don't see the question marks any more. If I click in Xcode "Get info" file encoding is UTF-16 for EN. But for the other language it is "No explicit file encoding".
testing
A: 

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.

testing
A: 

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

zoul