This repository was archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Localization
petrovWF edited this page Jun 16, 2021
·
2 revisions
This template supports multiple languages and in-app language change.
Official internationalization documentation: https://flutter.dev/docs/development/accessibility-and-localization/internationalization
flutter_localizations
intl
- Make sure generate set to true in pubspec.yaml
See the l10n.yaml
file in the root directory of the Flutter project that configures the localization tool.
Current l10n.yaml configuration:
- arb-dir: assets/l10n
- template-arb-file: app_en.arb
- output-localization-file: app_localizations.dart
Add .arb file in assets/l10n
for every locale you want to add in the app and translate all strings in that file.
Current locales:
- app_en.arb - English language (default)
- app_mk.arb - Macedonian language
To generate all the localizations just run your app or run flutter pub get
.
All generated localizations are in:
output-localization-file: app_localizations.dart
The localizationsDelegates and supportedLocales are set in the App widget (app.dart)
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
AppLocalizations.of(context)!.helloWorld