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?
Check my code at Github for a category on NSLocale to get an ISO 639.2 language code. It is as simple as:
[[NSLocale currentLocale] ISO639_2LanguageIdentifier];
No, you cannot do that. You have to convert them manually and this is not very simple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With