3

In my app I wanted to display a list of supported languages, displayed in their respective native language.

Like so without the detailText:enter image description here Apple has provided a sample code to get the values via this link which works fine

let frLocale = NSLocale(localeIdentifier: "fr_FR")
print(frLocale.displayNameForKey(NSLocaleIdentifier, value: "fr_FR")!)
// "français (France)”
print(frLocale.displayNameForKey(NSLocaleIdentifier, value: "en_US")!)
// "anglais (États-Unis)”

But when I tried to display "Indonesian" as "Bahasa Indonesia" with the locale identifier "id", my app displays it as "Indonesian"

I've tried with several other languages like French, Thai, and even Malay (Bahasa Melayu). They're all displayed correctly in their native language.

I've also tried to use different ISO639 standard such as "ind", but it still display "Indonesia" instead of "Bahasa Indonesia"

I've checked the language list in the settings app and it is displayed correctly as "Bahasa Indonesia", so obviously Apple did it right and I got the wrong display name.

How can I retrieve the same display name as the settings app?

user829227
  • 256
  • 2
  • 7

0 Answers0