Skip to content

Localization

aiserrock edited this page Jul 8, 2026 · 1 revision

Localization

acits_flutter uses easy_localization for all in-app text.

Structure

  • Translation files: assets/translations/en.json, assets/translations/ru.json
  • Both locales are kept complete — every key must exist in both files.
  • Fallback locale: ru
  • Generated keys: lib/generated/locale_keys.g.dart (LocaleKeys class)

Rules

  • No hardcoded UI strings. Any user-facing text must come from LocaleKeys + .tr().
  • Add new strings to both en.json and ru.json before regenerating keys.
  • Never edit locale_keys.g.dart by hand — it's generated.

Adding a new string

  1. Add the key/value to assets/translations/en.json and assets/translations/ru.json.
  2. Regenerate LocaleKeys:
fvm dart run easy_localization:generate -S assets/translations -O lib/generated -o locale_keys.g.dart -f keys
  1. Use the generated key in code:
Text(LocaleKeys.someKey.tr())

Notes

  • Run the regen command after every translation file change, and commit the updated locale_keys.g.dart alongside it.
  • CI/reviewers should reject PRs with hardcoded strings or mismatched keys between en.json and ru.json.

Clone this wiki locally