Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localizable.strings not working in iOS

I'm having this really mind breaking problem.

I created a Localizable.strings file in XCode and then 2 languages in it.

I filled up these files with the language translations, did a build/clean and then a fresh build, but there is no way the Localization strings show up in my project. If I try something like:

self.title = NSLocalizedString(@"HEAD", nil);

only "HEAD" instead of the translation shows up in the device simulator.

This is my project hierarchy:

project hierarchy

And this are the content of the English localization file: enter image description here

Any ideas?

like image 528
jbssm Avatar asked Jun 25 '12 18:06

jbssm


4 Answers

I found the answer myself.

Besides cleaning and building the project again and all that I described above. You must also delete the app in the iPhone simulator and then build it again! After that it works perfectly.

Talk about making it simple Apple...

like image 81
jbssm Avatar answered Nov 16 '22 10:11

jbssm


Be sure that:

  1. The file is called: "Localizable.strings".
  2. "Localizable.strings" belongs to the target you are dealing with.
like image 41
Javier Calatrava Llavería Avatar answered Nov 16 '22 11:11

Javier Calatrava Llavería


A few checks:

  1. Make sure the filename is exactly Localizable.strings and is included in the target
  2. Every string is ended with ;
  3. Every string is double quoted with "
  4. Comments begins with // (NOT #)
like image 20
samwize Avatar answered Nov 16 '22 11:11

samwize


Make sure you have Localizable.strings under Build Phases, Copy Bundle Resources.

like image 14
irmu Avatar answered Nov 16 '22 10:11

irmu