-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Expose API to get current locale #16
Comments
Hi, to find system locale I use this function: https://docs.flutter.io/flutter/intl_standalone/findSystemLocale.html The function that I wrote return a Locale instead of a String. If you prefer, I could make that method public. |
Yes please, I see you stored a |
That object doesn't represent the system locale, but the locale used by the library for translation purposes. |
Yes i would like to get the locale being used by the library. Thanks. |
Why you need it? |
Because my application would change language in runtime, I have an observable store to store the language that the app is using, when it changes, it triggers the component to re-render. |
Wait, you don't need to do this. |
No it's not about the system language. Like this example from you, My case is very similar, but in line 32 you initialized |
@ilteoood I did a bit of research and I think that the proper way to control the language inside the app is to set the If the locale changes, the If the Take the locale with the highest priority in the system language settings, that is also in the This also means that you shouldn't need a fallback file because the fallback locale is managed by flutter. But since you are not using the And when the locale is selected in this way, getting the current locale is really useful because I think the only alternative would be to create a custom You should take everything I just wrote with a grain of salt, as I am relatively new to flutter. |
Hi @Quijx, Thank you, |
Fixed with 9e56c99 Please pay attention to the breaking changes. Thank you so much for your contribute, |
Hi, thanks for creating this awesome plugin.
Is there any ways to get the current locale?
The text was updated successfully, but these errors were encountered: