Question

I have and XCode project with a list of supported languages. By default, XCode only lists 4 default languages when you click on "Add Localization" on the Localized Group info window. I just followed a sample project and added Localizations in a mix of full language names and some using the what I think is ISO 639-1 notation. What is weird is this:

I added a localization name "zh_CN" (just imitated the existing project) for Simplified Chinese. When the project is compiled, it has the .app/Contents/Resources/zh_CN.lproj/Localizable.strings. I change the system's language to Simiplified Chinese and run the app. Voila, it works and gets the Simplified Chinese Localizable.strings.

However, if I use NSLocale's API, I get "zh-Hans". "zh_CN" strings were loaded yet NSLocale returns "zh-Hans".

How does the Mac OS determine to use the "zh_CN" strings when using Simplified Chinese as the locale? Is there an API to know that the current system language will use the "zh_CN"?

Était-ce utile?

La solution

zh_CN is a old way to indicate Simiplified Chinese.
and now it's better to use "zh-Hans" instead. (in order to support old vernon of iOS and OSX, I think Apple will still support old style names like zh_cn.

(this document "Language and Locale Designations" explains everything :D)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top