This Flutter application demonstrates how to implement localization with multiple languages (English, Hindi, and Nepali) using Provider for state management and SharedPreferences for persisting the selected language.
- Localization support for:
- English
- Hindi
- Nepali
- Dynamic language switching using a dialog with radio buttons.
- Language preferences are saved using
SharedPreferences. - Integration with Flutter's
intlandflutter_localizations.
-
Enabling Localization Generation: In the
pubspec.yamlfile, under thefluttersection, I added the configuration to enable the generation of localization files, and the output localization file name (app_localizations.dart). -
Running
flutter gen-l10n: Instructions to runflutter gen-l10nto generate the necessary localization files from the ARB files. -
Dependencies: Added
intlandflutter_localizationsdependencies for localization support, along withproviderandshared_preferencesfor state management and saving user preferences.