react-native-localization-settings
react-native-localization-settings copied to clipboard
`getCurrentLanguage` iOS app system setting change bug
Hi, I encounter a bug when trying to change the language from the iOS system settings for the app.
Scenario 1
is where the bug reproducible steps.
Scenario 2
is the hypothesis I made based on the bug.
Scenario 1 (BUG)
User Preferred Languages Order:
- <App_NotSupportedLanguage>
- <AppSupportedLanguage_1>
- <AppSupportedLanguage_2>
- <AppSupportedLanguage_3>
When you select AppSupportedLanguage_1
, it won’t push to the first item on AppleLanguages.
From AppleLanguages
log: Return me the user's original language preference order.
Any App_NotSupportedLanguage
after the AppSupportedLanguage_1
will pushed to the first item when selecting on app system setting.
Scenario 2 (No bug)
User Preferred Languages Order:
- <AppSupportedLanguage_1>
- <App_NotSupportedLanguage>
- <AppSupportedLanguage_2>
- <AppSupportedLanguage_3>
When you select any AppSupportedLanguage
, it will push to the first item on AppleLanguages
Hypothesis
Please correct if I'm wrong. I suspect this is original behavior from the iOS which is due to how iOS handles app-specific language settings. When you select a language for your app in the system settings, iOS adds that language to the top of the AppleLanguages
array. However, if the first language in your system's preferred languages list is not supported by your app, iOS will not move the second language to the top of the AppleLanguages
array, even if your app supports it.