总是在iOS中获得ISO 639-2(三个字符)语言代码? [英] Always get ISO 639-2 (three character) language code in iOS?
问题描述
我正在开发一个需要三个字母(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(三个字符)语言代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!