Post

Replies

Boosts

Views

Activity

How to get the real app language code + variation?
Hello, I have the app localised to many languages and its variants, like English from Australia or Dutch from Belgium. My phone language is en_UK and the region is configured to ES. I cannot find a way to get the regional language code (ex: en_au, nl_be), it always gets simplified to the language (ex: en, nl), or adds my device region (ex: en-ES, nl-ES). Here I attach some examples while I have the app on en_au Locale.preferredLanguages ▿ 3 elements - 0 : "en-ES" - 1 : "ca-ES" - 2 : "es-ES" Bundle.main.preferredLocalizations ▿ 1 element - 0 : "en" NSLocale.current.languageCode ▿ Optional<String> - some : "en" Locale.current ▿ en_001@rg=eszzzz (fixed en_001@rg=eszzzz) - identifier : "en_001@rg=eszzzz" - locale : "fixed en_001@rg=eszzzz" Locale.autoupdatingCurrent.languageCode ▿ Optional<String> - some : "en" Locale.current.languageCode ▿ Optional<String> - some : "en" Locale.preferredLanguages[0] "en-ES"
2
0
159
1w