IOS localization broken with iOs 9 + Xcode 7 update

I localized my application in Italian and English using the Localizable.strings file and NSLocalizedString macro . I also included base localization . Everything works fine in the simulator and on devices with iOS 8, but on iOS 9 the application is always in English, even on devices with the Italian language selected by default in the iPhone settings. Is iOS 9 changing anything with localization?

Here is a screenshot of the Xcode localization settings
http://i.imgur.com/xc20yjj.png 1

And the device used for testing
http://i.imgur.com/QCjn52u.png

Thank you in advance

+5
source share
3 answers

Solved, the "problem" was the key "local area development localization" in the info.plist file. It was installed in Italy, so when the application was launched on the device with the Italian language by default, it showed the version of the database localization (English version). Changing the meaning for the United States solved the problem.

+8
source

I have another solution, just delete the "Localization" key in info.plist. This works for my case.

+2
source

I found a workaround. The root cause of this problem is that Apple has changed the "Language Identifiers" in iOS 9, please refer to this .

Since NSLocalizedString() (and its variants) "AppleLanguages" key in NSUserDefaults to determine which user preferences for preferred languages. I forcibly used NSLocalizedString to use a specific language, which is marked as their old language identifiers in older versions of iOS, when I found their language identifier in a new format. In other words, I did an "AppleLanguages" key value "AppleLanguages" .

To do this, refer to: How to force NSLocalizedString to use a specific language

I think Apple has done a very poor job in compatibility.

+1
source

Source: https://habr.com/ru/post/1231997/


All Articles