I have an localized iOS App from which I want to obtain the device language (not the app language). The following sample app is localized in English and German. The current app language is German.
Here I want to obtain english, since that's the device language (see next screenshot).
Device Language Settings:
App Language Settings: (shouldn't be considered for obtaining device language)
Is there any API I could use to retrieve the device language?
To obtain the device language is a product management requirement to derive next steps in the app localization process.
Code of sample App:
struct ContentView: View {
var body: some View {
Form {
Text("Hello, world")
Text("Locale.preferredLanguages:\n\(Locale.preferredLanguages.joined(separator: ", "))")
Text("Locale.current:\n\(Locale.current.language.languageCode?.identifier ?? "")")
}
}
}
Note: I have asked this question on Stack Overflow too (see here)