Localization
Manage translations with the l10n package.
The app is availabel in English and German. For the localization the flutter_localizations
package is included in pubspec.yaml
More information about this can be found in the official documentation https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization
Change language
The language of the complete app can be changed via the prebuild widget
LanguageDropdown1()
Add or change texts
To add more text the .arb files in folder /lib/l10n
must be extended.
Afterwards these texts can be referenced in the code with this expression
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
...
AppLocalizations.of(context)!.[TEXT ID]
The [TEXT ID] is the one referenced in the .arb files.
Add more languages
To add more languages add the respective entries in l10n.dart
and localization_repository.dart
at the places in the code that are marked with this comment
//! add languages here
For every language a translation file with the name app_[LOCALE].arb
must be added to the folder /lib/l10n
Last updated