问题描述
我正在处理一个需要三个字母 (ISO 639-2) 语言代码才能访问 REST 服务的项目.我希望使用 [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]
来使用当前语言设置.不幸的是,此方法更喜欢返回两个字母 (ISO 639-1) 的语言代码.有什么方法可以强制 NSLocale 返回更新后的代码,还是可以使用另一种方法将两字母语言代码转换为三字母语言代码?
I'm working on a project that requires a three letter (ISO 639-2) language code to access a REST service. I was hoping to use the current language setting using [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]
. Unfortunately, this method prefers to return two letter (ISO 639-1) language codes. Is there a way I can force NSLocale to return the updated codes, or is there another method I can use to convert a two letter language code to a three letter language code?
推荐答案
不,你不能那样做.您必须手动转换它们,这不是很简单.
No, you cannot do that. You have to convert them manually and this is not very simple.
这篇关于总是在 iOS 中获得 ISO 639-2(三字符)语言代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!