iosios13

How to programmatically access the apps language in iOS 13?


Starting from iOS 13 Apple allows to:

Language selection per app

Use third‑party apps in a different language from your system language.

As I can see in the Settings app on the settings page of my app there is a new "Prefered Language" entry revealing a selection of the localized languages of my app.

Example from Facebook:

iOS App Facebook Settings

Image source


Can I programmatically access the value of the selected language?

If so with which key?

[[NSUserDefaults standardUserDefaults] objectForKey:@"key???"];

Solution

  • You may try the below code to get the application preferred language.

    let appLang = Locale.preferredLanguages[0]