I have an app that I'm translating to different languages using Flutter L10N. I have this in my MaterialApp:
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales
and it works, but the language is automatically set to device language. I want to select the language using a dropdown box, but also have the option to auto-select it.
Any help would be appreciated!
Thanks :)
CodePudding user response:
Just read this post on Medium. It's pretty simple describes how to make your app translated with multiple languages.
On Step 9 you can find the LocaleProvider
code, with which it's possible to switch between languages in your app.
CodePudding user response:
You can use my approach https://github.com/IvanovYevgen/setup_pr Just get local from state of cubit. But it is possible to write more complicated code, when you will preserve user's local on server and get it accordingly user's choice.