views:

920

answers:

3

What's the locale code for traditional Chinese and French Canadian to be used for iPhone localizable strings file. I know the code for simplified Chinese and French, which is zh and fr, but not its counterpart.

+3  A: 

Set it on your device and execute

NSLog(@"localeIdentifier: %@", [[NSLocale currentLocale] localeIdentifier]);
Nikolai Ruhe
A: 

You can change your language in the iPhone Simulator (though 'Settings'). The following code will show the language code:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
NSString *currentLanguage = [languages objectAtIndex:0];
NSLog(@"Current language: %@", currentLanguage);
eelco
A: 

After some experiments, I found out that the locale code used to name the localization strings file for Chinese are:

zh_hant (traditional)

zh_hans (simplified)

Boon