easy_localization icon indicating copy to clipboard operation
easy_localization copied to clipboard

Title in app bar and label in bottom navigation bar item not translate after setting locale

Open iyar-avital opened this issue 3 years ago • 8 comments
trafficstars

I use easy localization 3.0.0.

I have a page with a bottom navigation bar and app bar. when I change the current language by: context.setLocale(Locale("he"));

image

All content changes except the title and the label in bottom navigation bar until I press one of the icons in the bottom navigation.

I have seen similar problems and none of them helped me come up with a solution:/

iyar-avital avatar Dec 12 '21 13:12 iyar-avital

i am facing the same issue

pranavo72bex avatar Jan 18 '22 08:01 pranavo72bex

I am facing same issue

sumanpdneupane avatar Feb 14 '22 13:02 sumanpdneupane

@aissat I noticed you closed this old issue: https://github.com/aissat/easy_localization/issues/108 Do you know if there is a fix for this issue?

og1-alarm avatar Aug 15 '22 15:08 og1-alarm

I was able to resolve it

og1-alarm avatar Aug 18 '22 05:08 og1-alarm

I was able to resolve it

Can you tell me how you do it?

duongtk98 avatar Dec 14 '22 07:12 duongtk98

Any solutions?

cancng avatar Dec 23 '22 09:12 cancng

I found the problem with me. When I used the bottom navigation, the page menu tab had the widget: const menuScreen()

When I remove the const word it worked great

iyar-avital avatar Dec 23 '22 10:12 iyar-avital

Please post the code you used, or a minimal sample, so we can reproduce the behavior and show how to fix it.

bw-flagship avatar May 14 '23 11:05 bw-flagship

My solution is adding a Locale constructor argument to bottom navigation's wrapper Widget, give it the value of context.locale, so when context.locale changed, bottom navigation will be re-rendered.

But it seems not the best way, hope the team offer us the official solution.

kevinat avatar Apr 14 '24 02:04 kevinat

@kevinat did you try using context.tr() instead of just tr()?

bw-flagship avatar Apr 15 '24 06:04 bw-flagship

@bw-flagship I just tried using context.tr(), it works. Thank you for helping.

And I found wherever I put JUST ONE context.tr(''), or ''.tr(context: context) in bottom navigation's build function, even with an empty string, all other String.tr() or tr(String) works. It's little odd, and only bottom navigation has this issue by far.

Anyway I'm now using your suggestion in my project, instead of passing Locale argument.

kevinat avatar Apr 16 '24 00:04 kevinat

@kevinat Nice to hear that it works!

I created #660 to clarify in the readme that context.tr() is the way to go for build methods.

Closing this one.

bw-flagship avatar Apr 16 '24 06:04 bw-flagship