In Objective-C, I can easily get a list of available locales, for example:
NSArray *test = [NSLocale availableLocaleIdentifiers];
NSLog(@"%@", test);
for (int i = 0; i < [test count]; i++) {
NSLog(@"%@", [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[test objectAtIndex:i]]);
}
This gives me a list such as this:
Spanish (United States)
Macedonian (Macedonia)
Oromo (Kenya)
Danish (Denmark)
Korean (South Korea)
Tachelhit (Latin)
Fulah (Senegal)
Indonesian
Serbian (Cyrillic, Montenegro)
Makonde (Tanzania)
Welsh
However, instead of a list of locale names, I would like to get a localized list of language names, as in the Settings app. For example, if the phone is in the US locale, I want to get "English", if the phone is in French, "English", and if in German "Englisch". What is the best way to create such a localized list of language names?
Jason source
share