views:

30

answers:

2

is there a way to get all available languages on the iphone just like in the settings app?

can't find a method in NSLocales Class Reference.

thanks!

alt text

A: 

[NSLocale preferredLanguages] will get you a list of codes like this, which you can translate yourself:

en,
fr,
de,
ja,
nl,
it,
es,
nevan
are this "all" languages, and whant means "translate myself"? i need the local identifier.
choise
You need to translate "en" into "English" and so on.
nevan
+1  A: 

Well, there is [NSLocale availableLocaleIdentifiers]

EDIT: what do you mean by “I need the local identifiers”? Do you mean the NSLocale identifiers or the localized language names? I fear the latter is not possible.

Raphael Schweikert
i need exactly the same thing as in the settings "app". i want to store the local identifier to a string and work with it at some other time with `initWithLocaleIdentifier`. i will then run several things, using Numberformatter, dateformatter and so on
choise
I’m pretty sure [NSLocale availableLocaleIdentifiers] yields exactly the list you need but I’m also pretty sure it’s not possible to construct human-readable names from the locale identifiers.
Raphael Schweikert