I used NativeModules.SettingsManager.settings.AppleLocale to define interface language in my app. After updating xcode to version 11.0 (11A420a) and run in emulator on ios 13 it stopped work.
We are automatically closing this issue because it does not appear to follow any of the provided issue templates.
馃憠 Click here if you want to report a reproducible bug or regression in React Native.
I'm in the same situation. Does anyone managed to get it working?
Yes.
When you launch the fresh simulator or you have a device with language without a region, AppleLocale is nowhere to be found in NSUserDefaults on iOS 13. Now when you do change it to, for example, English(Canada) -> it's there.
Workaround:
let locale = NativeModules.SettingsManager.settings.AppleLocale // "fr_FR"
if (locale === undefined) {
// iOS 13 workaround, take first of AppleLanguages array ["en", "en-NZ"]
locale = NativeModules.SettingsManager.settings.AppleLanguages[0]
if (locale == undefined) {
locale = "en" // default language
}
}
Similar issue on expo here: expo/expo#5735 (comment)
As per my understanding the problem is that if the phone (either device or simulator) has the default language because the user didn't set it, all the language properties like timezone, country, currency and so on are undefined raising the exception
I'm able to reproduce the issue with iOS13 on a fresh simulator or on some devices.
Changing the language in "settings" to English/UK or English/US, the Localization.* properties are set properly.
More or less, that was what I was going to do, but I was waiting if there was another way.
Thanks a lot
Much appreciated
This is the path I followed: https://docs.expo.io/versions/latest/sdk/localization/
Most helpful comment
Yes.
When you launch the fresh simulator or you have a device with language without a region, AppleLocale is nowhere to be found in NSUserDefaults on iOS 13. Now when you do change it to, for example, English(Canada) -> it's there.
Workaround:
Similar issue on expo here: expo/expo#5735 (comment)