我打算为APP集成翻译功能,现在问题是如何获取iOS系统的所有语言的列表,我好方便将iOS的语言的格式和我用的翻译服务的语言格式进行对应。
例如:
zn-Hans -> zh
这种对应
PHPz2017-04-17 17:43:47
You can try NSLocale::availableLocaleIdentifiers
以及 NSLocale::componentsFromLocaleIdentifier:
these interfaces.
// 获取系统当前支持的语言代号:
NSArray *localeIdentifiers = [NSLocale availableLocaleIdentifiers];
The content is roughly as follows:
(
eu,
"hr_BA",
"en_CM",
"rw_RW",
"en_SZ",
"tk_Latn",
"uz_Arab",
"he_IL",
ar,
"en_PN",
as,
"en_NF",
"rwk_TZ",
"zh_Hant_TW",
"gsw_LI",
"th_TH",
"ta_IN",
"es_EA",
"fr_GF",
...
)
For specific documentation, see: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSLocale_Class/index.html