easy_localization
easy_localization copied to clipboard
Ability to get translations for specific locale without changing the application locale
Hello,
I'm working on a Flutter application using Easy Localization. I encountered a scenario where I need to get a translation for a specific locale without changing the application locale.
In my use case, I have a class that receives keys and returns translations. I'd like to be able to provide a locale to this class and have it return translations in that locale, but without changing the global locale of the app. This is used to print receipts which are in a different language than the application language
Currently, it seems that the only way to change the locale of translations is to change the application locale using context.setLocale(). But this affects the entire application and changes translations everywhere, not just in my class.
I could manually load and parse localization files to get translations for a specific locale, but this feels a bit cumbersome and not ideal.
Is there a better way to get translations for a specific locale without affecting the global locale of the app, or could this be a feature to consider adding to Easy Localization?
Thank you in advance for your help!
I also need this ability, do you get any update?
Same here. I tried to use different EasyLocalization
widget instances with no luck