Skip to content

Conversation

@PRESIDENT810
Copy link

@PRESIDENT810 PRESIDENT810 commented Dec 26, 2025

Summary:

In #53417 I used Locale.getAvailableLocales()[0] to obtain the prioritized locale, which is incorrect according to @mukti107's comment. This returns "an array of all installed locales". However, what we want is the preferred locale specified by users, so it should be context.resources.configuration.locales[0].

I also renamed this from isDevicePreferredLanguageRTL to isApplicationPreferredLanguageRTL so it aligns with iOS's implementation (isDevicePreferredLanguageRTL is not used anywhere in iOS, and isApplicationPreferredLanguageRTL is the one that actually get used) and reflects the usage of this function more accurately (context.resources.configuration.locales[0] would also respect per app's language settings, in addition to system language settings).

Note: since 0.76 React Native's minimum Android support SDK version becomes 24, so using locales which is added in API level 24 should be safe.

Changelog:

Same as in #53417, I used

import { I18nManager } from 'react-native';

I18nManager.allowRTL(true);
I18nManager.swapLeftAndRightInRTL(true);

Then I tried to set system's language to English and Hebrew, then set app's language settings to English and Hebrew. The directionality always conforms to the per app settings. If per app settings not set (use "System Default") then it would conform to the system language.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 26, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants