[英]Flutter Easy Localization Doesn't Change Bottom Navigation Bar Item's Titles
I am using easy_localization 3.0.1
for use several language in my app.我正在使用
easy_localization 3.0.1
在我的应用程序中使用多种语言。
main file have 4 pages to navigate and I am using bottom navigation bar to change body of this file.主文件有 4 个页面可供导航,我正在使用底部导航栏来更改此文件的主体。
In Profile page I should have change language of the app with button在个人资料页面中,我应该使用按钮更改应用程序的语言
onPressed:(){context.setLocale(Locale("tr", "TR"));}
but with this function the title's of the bottom navigation bar items are not changing.但是这个 function 底部导航栏项目的标题没有改变。 When I use
setState
they are changing but i need to make it without setState当我使用
setState
时,它们正在改变,但我需要在没有 setState 的情况下进行
You can use Getx, GetX Translation is best option for localization您可以使用 Getx,GetX 翻译是本地化的最佳选择
return GetMaterialApp(
translations: Messages(),
locale: Locale('tr', 'TR'),
);
Using translation with parameters使用带参数的翻译
Map<String, Map<String, String>> get keys => {
'en_US': {
'logged_in': 'logged in as @name with email @email',
},
'tr_TR': {
'logged_in': '@name ile e-posta @email olarak giriş yaptı',
}
};
Change locale更改语言环境
var locale = Locale('tr', 'TR');
Get.updateLocale(locale);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.