NSLocalizedString gives other language then phone is in

366 views Asked by At

My project base language is English. My simulator/phone is in English. The projects supports English, French, Dutch.

When the app starts for the first time the app is always in French even when the phone is in English.

When I debug and print out this line:

[NSLocale preferredLanguages][0];

It gives me the correct language namely English.

Does someone have an idea why this is?

2

There are 2 answers

1
Doro On BEST ANSWER

Please, check the following.

  1. Tap on your project_name -> edit scheme...
  2. Click on 'Options' tab
  3. Select on 'Application language' English (or whatever you need)

Just renaming localization files may cause some other bugs. Here is Apple guide about base localization:

https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/InternationalizingYourUserInterface/InternationalizingYourUserInterface.html

In order to remove base localization:

  1. click on your project in file inspector.
  2. Select 'Info' tap on yours project and deselect 'Use base Internationalization' on 'Localizations' section

Hope this helps.

0
Bhanupriya On

I'm guessing Apple broke something with the simulator, because it works on real devices from Xcode 6.1. Check on real device