msayed-net / localize_and_translate

Flutter localization in easy steps
MIT License
52 stars 22 forks source link

I Cant Use Restart true When iam setting new language Please How Can i do that #28

Closed Abodysoma2021 closed 2 years ago

Abodysoma2021 commented 2 years ago

Screen Shot 2021-12-23 at 9 29 54 AM

msayed-net commented 2 years ago

Could you share your main() implementation please

Abodysoma2021 commented 2 years ago

void main() async { WidgetsFlutterBinding.ensureInitialized(); // Initilize Localization With localize_and_translate Package await translator.init( localeType: LocalizationDefaultType.device, languagesList: ['ar', 'en'], assetsDirectory: 'assets/lang/', ); runApp(LocalizedApp(child: MyApp())); }

//hello class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { //Wrap Application With Getx Package return GetMaterialApp( initialBinding: Binding(), // initialRoute: homeController.initScreen == 0 ? OnboardingScreen() :HomeView(), debugShowCheckedModeBanner: false, title: 'Moya App', theme: ThemeData( primarySwatch: AppStyles.primaryColor, scaffoldBackgroundColor: AppStyles.backgroundColor, fontFamily: 'Sfpro'), home: ControlView(), localizationsDelegates: translator.delegates, // Android + iOS Delegates locale: translator.activeLocale, // Active locale supportedLocales: translator.locals(), // Locals list ); } }

Abodysoma2021 commented 2 years ago

Could you share your main() implementation please

void main() async { WidgetsFlutterBinding.ensureInitialized(); // Initilize Localization With localize_and_translate Package await translator.init( localeType: LocalizationDefaultType.device, languagesList: ['ar', 'en'], assetsDirectory: 'assets/lang/', ); runApp(LocalizedApp(child: MyApp())); }

//hello class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { //Wrap Application With Getx Package return GetMaterialApp( initialBinding: Binding(), // initialRoute: homeController.initScreen == 0 ? OnboardingScreen() :HomeView(), debugShowCheckedModeBanner: false, title: 'Moya App', theme: ThemeData( primarySwatch: AppStyles.primaryColor, scaffoldBackgroundColor: AppStyles.backgroundColor, fontFamily: 'Sfpro'), home: ControlView(), localizationsDelegates: translator.delegates, // Android + iOS Delegates locale: translator.activeLocale, // Active locale supportedLocales: translator.locals(), // Locals list ); } }

msayed-net commented 2 years ago

Thanks for sharing,

and how do you call setNewLanguage(), what parameters did you use.

Abodysoma2021 commented 2 years ago

Screen Shot 2021-12-28 at 9 59 21 AM

Thanks for sharing,

and how do you call setNewLanguage(), what parameters did you use.

msayed-net commented 2 years ago

You are using the latest version 4.1.1 correct!

Forgive me for the late response, I'm working on the next localization package (palestine_localization) with so many new features.

msayed-net commented 2 years ago

Please test different versions from the one you are using right now

Abodysoma2021 commented 2 years ago

Please test different versions from the one you are using right now

Yes I Have Change The Version To 4.0.0 And It Work Fine Thanks