BowlerKitBowlerKit
Features

Internationalization (i18n)

10/11/2026

Add and switch Flutter localizations with ARB files and Riverpod preferences.

Current setup

The template uses Flutter's generated localization system:

  • l10n/app_en.arb
  • l10n/app_id.arb
  • l10n/generated/app_localizations.dart
  • l10n.yaml

SupportedLocales also exposes a system sentinel so users can follow the device language. English and Indonesian are the bundled locales.

Selecting a language

user_preferences_provider.dart persists the selected code through SharedPreferences. The Account sync service sends the language to PUT /api/v1/app/preferences; Guest mode keeps it local. The localization_provider.dart maps the stored code to Locale/system behavior.

Use generated localization access in widgets:

final l10n = AppLocalizations.of(context)!;
Text(l10n.settings);

Add a locale or key

  1. Add the key/value to both l10n/app_en.arb and l10n/app_id.arb (or add a new ARB locale intentionally).
  2. Keep placeholders and descriptions consistent.
  3. Run flutter gen-l10n (or the IDE's Flutter localization generation) to refresh l10n/generated/.
  4. Use the generated AppLocalizations getter; do not hardcode user-facing strings.
  5. Test system language, explicit language, fallback, and persisted preference behavior.

Relevant files

  • l10n.yaml
  • l10n/app_*.arb
  • l10n/generated/
  • providers/localization_provider.dart
  • providers/user_preferences_provider.dart
  • lib/main.dart