react-native-localization-settings icon indicating copy to clipboard operation
react-native-localization-settings copied to clipboard

`getCurrentLanguage` iOS app system setting change bug

Open chiew256 opened this issue 1 year ago • 0 comments

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:

  1. <App_NotSupportedLanguage>
  2. <AppSupportedLanguage_1>
  3. <AppSupportedLanguage_2>
  4. <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:

  1. <AppSupportedLanguage_1>
  2. <App_NotSupportedLanguage>
  3. <AppSupportedLanguage_2>
  4. <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.

chiew256 avatar Feb 21 '24 15:02 chiew256