On iOS Bundle.main.preferredLocalizations
returns the list of languages the application bundle supports in user-preferred order with the first
element being the language the application is running in.
Additionally Locale.preferredLanguages
returns the list of languages in the order they are presented in Preferences.app > General > Language & Region > Preferred Languages with the first
element being the user's "primary language" (i.e. the language the system is running in).
However this only seems to be true unless the user has chosen a per-app language which is different from the primary language in which case Locale.preferredLanguages.first
is equal to Bundle.main.preferredLocalizations.first
- regardless of the latter's position in the Preferred Languages list.
Furthermore this seems to change depending on the value of the "AppleLanguages" key in the User Defaults' global domain (see c.f. https://stackoverflow.com/a/42648166).
Is this behaviour documented anywhere?
Addendum: I know that according to https://forums.developer.apple.com/forums/thread/718512?answerId=733680022#733680022
AppleLanguages is an implementation detail, not something that’s considered API.
Locale.preferredLanguages
is API, though.