I use :
NSString *language = [[NSLocale currentLocale] objectForKey: NSLocaleLanguageCode];
to determine the user language.
Where can I get the full list of the possible returned values (e.g. "fr"), and corresponding language (e.g. "french").
Thanks !
There are 2 ways you can go.
Locale.isoLanguageCodes and extract all 2-letter codes: for languageCode in Locale.isoLanguageCodes {
print(languageCode) // or print(languageCode.prefix(2))
}
Locale.availableIdentifiers and execute Locale.components(fromIdentifier:_) on every item.for identifier in Locale.availableIdentifiers {
let components = Locale.components(fromIdentifier: identifier)
// ...
}
A full list is standardized in ISO-639-1 list.
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