Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
403 stars 118 forks source link

change Locale lang in app lunch (main method) #25

Closed mohafouad closed 4 years ago

mohafouad commented 4 years ago

i saved current lang in SharedPreferences key when app start i get this key and want to set this as my current local

i tray with main method

String currentLang=await AppUtil.currentLang(); var delegate = await LocalizationDelegate.create( fallbackLocale:currentLang !=null && currentLang != "" ? currentLang : 'en_US', supportedLocales: ['en_US', 'ar']);

but not work as expected

bratan commented 4 years ago

This is not the correct way to do this. Please see saving/restoring the selected locale for an example.

The fallbackLocale is only used for fallback, not for actually changing the locale.