zoontek / react-native-localize

🌍 A toolbox for your React Native app localization
MIT License
2.28k stars 212 forks source link

Add support for "app languages" on Android #245

Open abejfehr opened 9 months ago

abejfehr commented 9 months ago

Why it is needed?

It's nice to be able to choose a language on a per-app basis instead of setting the whole OS, and it looks like that's possible now on Android: https://developer.android.com/guide/topics/resources/app-languages

Possible implementation

No response

Code sample

No response

Upvote & Fund

Fund with Polar

zoontek commented 9 months ago

@abejfehr It's already supported. Android now allow the user to overrides the app language in app settings and it updates what's returned by existing react-native-localize functions.

EDIT: Hmmm, I forget Android API are often stupidly designed. Will investigate on extras setApplicationLocales() and [getApplicationLocales()](https://developer.android.com/reference/android/app/LocaleManager#getApplicationLocales()). But if this allow overriding from the app directly, this is a terrible feature for user experience.

itsramiel commented 1 week ago

EDIT: Hmmm, I forget Android API are often stupidly designed. Will investigate on extras setApplicationLocales() and [getApplicationLocales()](https://developer.android.com/reference/android/app/LocaleManager#getApplicationLocales()). But if this allow overriding from the app directly, this is a terrible feature for user experience.

What is your opinion on this @zoontek ?

The android apis make it just so that you dont have to go to the settings to change the per app language. From the linked guide:

If you use the public APIs for your in-app language picker, the device's system settings are automatically updated to match whichever language the user selects through your in-app experience.

These APIs automatically sync with system settings; therefore, apps that use these APIs to create custom in-app language pickers will ensure their users have a consistent user experience regardless of where they select their language preferences

zoontek commented 1 week ago

@itsramiel This does not seems like a lot of work, but it's very low-priority for me at the moment. Let’s place a small bid on it and see if companies have a real appetite for it.

zoontek commented 1 week ago

You can now pledge behind and help support this effort using Polar.sh:

Fund with Polar