-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: get/set app locale #282
Conversation
@itsramiel Hey! Thanks for this, but can you reduce the amount of changes to the absolute strict minimum? So just the getter / setter. No code organization change, no event emittters, etc. |
Sure, but no event emitters would be an incomplete feature. If a user change the language from system settings, the app would not know that without an event. The radical changes to the I can drop these changes if you want, but let me know how you would like to notify changes back to the user. |
EDIT: Just got it. This can work without updating the whole code organisation (keeping static methods). Check how I do on rn-edge-to-edge: https://github.com/zoontek/react-native-edge-to-edge/blob/main/android/src/oldarch/com/zoontek/rnedgetoedge/EdgeToEdgeModule.kt |
In the linked code, you are not sending events to js(as far as I can see). I am not sure what you are referring to. I'll be waiting for your feedback before moving forward with this pr cause I am not sure how you want me to proceed. |
I'm not, but you easily call a static method that will do it: |
Yes, in this case since you are creating a broadcastlistener while having access to the context. |
@itsramiel But it also creates the need for an expo plugin, as it must modify the EDIT: works perfectly on my side, I tried on API 29: |
I finally took some time to read the feature documentation and experiment with it. I really dislike the Android API and developer experience—it seems like a mistake to expose it to React Native developers as it currently is. The goal is to have an in-app language picker that syncs with a device-level language setting (peak UX, thanks Google), so there’s plenty of room for a cleaner, cross-platform API. But to be honest, I don’t currently have the free time to devote to this, including helping with its design or reviewing it. |
Got it. Thank you for taking the time to check it. Will be closing it for now |
Summary
- get the application preferred languages
- setting application preferred languages
Helpful for creating in-app language pickers(on Android) which sync with app system settings
Test Plan
What's required for testing (prerequisites)?
What are the steps to test it (after prerequisites)?
Compatibility
Checklist
README.md
example/src/App.js
)