Wonderful package!
Is there a way to change layout direction for RTL languages when using GetX translations?
Thanks for noticing that @smokelaboratory !
I didn't try the internationalisation capabilities of GetXâ„¢ until now.
I just pushed a fix to refresh the UI when you Get.changeLocale(), and included in the docs and README.
Please, give it a try when it gets merged, and let me know if the issue is solved.
@roipeker
I have same issue, and I try what you included in README, but still have issue.
layout does not update on changing locale, but update after after hot reload.
Widget build(BuildContext context) {
return StoreProvider<AppState>(
store: store,
child: AppThemeProvider(
child: (themeContext) => GetMaterialApp(
title: Strings.appName,
debugShowCheckedModeBanner: false,
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
translations: Translation(),
locale: Locale('fa', 'IR'),
fallbackLocale: Locale('en', 'US'),
supportedLocales: [Locale('fa', 'IR'), Locale('en', 'US')],
popGesture: true,
theme: ThemeProvider.themeOf(themeContext).data,
home: InitialApp(),
),
),
);
}
@Hamidrezana
I think the change is not yet merged. It is under review.
Here is the PR for it (https://github.com/jonataslaw/getx/pull/601)
@smokelaboratory tnx.
wonderful approach
Hy here is the temporary fix To Change Language using GetX utils(RTL and LTR)
static void setLocale(BuildContext context,Locale locale){
final _MyAppState state=context.findAncestorStateOfType<_MyAppState>();
state.setLocale(locale);
void setLocale(Locale locale){
setState(() {
_locale=locale;
});
}
Locale _locale;
locale: _locale??_setLanguage(),
localeResolutionCallback: (deviceLocale,supportedLocale){
for(final locale in supportedLocale){
if(locale.languageCode==deviceLocale.languageCode&&locale.countryCode==deviceLocale.countryCode){
return deviceLocale;
}
}
return supportedLocale.first;
},
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: <Locale>[Locale('en', 'UK'), Locale('en', 'US'), Locale('ar','AE')],
Locale _setLanguage() {
Locale _locale;
final _box = Hive.box(kConfigDBKey);//kConfigDBKey is Db key to store user select lang
final String _language = _box.get(kConfigBoxFieldLang).toString();//kConfigBoxFieldLang is variable Key to get user selected lang
switch (_language) {
case 'ar':
_locale = const Locale('ar', 'AE');
break;
case 'en':
_locale = const Locale('en', 'US');
break;
default:
_locale = const Locale('en', 'US');
}
return _locale;
}
MyApp.setLocale(context, _locale);
Get.updateLocale(_locale);
@jonataslaw Has this update been released?
Has this update been released?
not yet @Hamidrezana
@jonataslaw I still have problem after upgrading to new version and layout doesn't update.
Hy i have updated a patch in Get slack channel Utils section for RtL layoit
changes.
Please have a look at it
On Thu, 24 Sep 2020, 18:46 Hamidreza Nazemi, notifications@github.com
wrote:
@jonataslaw https://github.com/jonataslaw I still have problem after
upgrading to new version and layout doesn't update.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/jonataslaw/getx/issues/600#issuecomment-698354325,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMQZ37WLSPU2F6N2WNY2ZXDSHNES5ANCNFSM4RJJ7DTA
.
any news about RTL support?