Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa/iPhone: How do I create a Simplified Chinese localization of my app?

I'm in the middle of localizing my iPhone app, and I've gotten English, French, German and Japanese localizations working without any problems. Now I'm trying to get a simplified chinese localization working, and no matter what I try, the chinese .lproj bundle just won't be used when I have the phone set to simplified chinese.

One problem is that I'm not sure what the localization should be called. I've tried "Chinese", zh-Hans, zh-CN, zh_Hans, zh_CN and none of them work. I've even gone as far as digging around inside Remember The Milk's app bundle to see what they used. They're using zh_CN but that doesn't work for me.

Am I missing something obvious here? Do I need to update some plist somewhere? As far as I can see from reading the I18N documentation and looking at the relevant WWDC session video, all I should need to do is make sure I have the right .lproj bundle in my app bundle and I should be good to go... right?

If you think it would help, I can provide a test xcode project that demonstrates the problem...

Thanks

like image 325
Mike Akers Avatar asked Mar 11 '09 14:03

Mike Akers


People also ask

How iOS determines the language for your app?

A: To determine the language for your app, iOS considers not only the order of the user language preferences (in General > Language & Region of the Settings application) but also the localizations your app declares it supports.

How do I add localization files to Xcode?

Right click your project folder, select 'New File' , then scroll down to find 'Strings', select it and click 'Next'. Then name the file as 'Localizable. strings' and click 'Create'.

What is Localisation in iOS?

Localization is the process of translating and adapting your app into multiple languages and regions. Localize your app to provide access for users who speak a variety of languages, and who download from different App Store territories.

How do you perform localization in iOS Swift?

Click on iOS->App/Single View App->Next. Name your project and select the language as Swift. Select a desired location and click on Create. To start with Localization, click on your Project Name -> go to Info Tab -> Under Localizations, click on the '+' button.


2 Answers

It's zh_CN for Simp. Chinese (简体中文), zh_TW for Trad. Chinese (繁體中文).

If you are testing zh_CN.lproj under Trad. Chinese Language setting, it won't work. Just make sure you are testing your app with correct system language setting. Also, the Localizable.strings should be encoded with UTF-16 encoding.

Update:
In latest Localization Programming Guide, these had been changed to zh-Hans and zh-Hant.

Particularly in Chinese dialects, a region code is not always the best way to specify the proper dialect or script. For example, traditional Chinese (Han) is the default language spoken in Taiwan and is identified by the code zh_TW in Mac OS X v10.3.9 and earlier. However, traditional Chinese is also commonly spoken in Hong Kong and Macao, which means the zh_TW designator is not entirely accurate in those locations. The new standard defines new tags for the traditional Chinese (Hant) and simplified Chinese (Hans) scripts. Thus, traditional Chinese spoken in any country uses the code zh-Hant. Traditional Chinese, as it is spoken in Taiwan, now uses the locale code zh-Hant_TW.

like image 136
digdog Avatar answered Oct 30 '22 12:10

digdog


Since iPhone likes to cache resources, you should clean up your app project and re-build it. Then everything will work fine with your localization.

like image 22
kslcam Avatar answered Oct 30 '22 13:10

kslcam