3

I know I can get the device's current Locale easily but in my case, the user chooses the language from a UIPickerView. Each language is a string in a array typed exactly the same way the phone has it in the settings for setting the device language.

Is it possible to get the language abbreviation from a string like @"English" or @"Arabic"?

Thanks!

Pfitz
  • 7,336
  • 4
  • 38
  • 51
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191

1 Answers1

3

NSLocale's +canonicalLocaleIdentifierFromString: does this translation.

一二三
  • 21,059
  • 11
  • 65
  • 74
  • Thanks but the only issue is Chinese (simplified or traditional), it doesn't seem to get that one :/ – SimplyKiwi Jan 08 '12 at 00:50
  • 1
    They are identified with "Simplified Chinese" and "Traditional Chinese". Refer to ICU's list of [Language Display Names](http://demo.icu-project.org/icu-bin/locexp?_=en&SHOWLanguages=1#Languages) for a complete list. – 一二三 Jan 08 '12 at 10:01