iOS 获取系统所有的语言列表
PHP中文网
PHP中文网 2017-04-17 17:41:47
0
1
924

我打算为APP集成翻译功能,现在问题是如何获取iOS系统的所有语言的列表,我好方便将iOS的语言的格式和我用的翻译服务的语言格式进行对应。

例如:

zn-Hans -> zh

这种对应

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
PHPzhong

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template