Internationalization for Flutter
Translations with locale switching
i18n is opt-in and only for apps that ship two or more locales. When they do, the kit uses slang, the only sanctioned code-generation exception.
What this feature covers
- Translations: JSON translation files compiled into typed accessors.
- Locale switching: Runtime locale change without restarting the app.
- Config: slang configuration and native iOS and Android locale setup.
- Codegen: The one place the kit allows build_runner, scoped to slang.
How Flutter Agent Kit implements it
slang_build_runner is the only code generator the kit permits; every other generator, including freezed, json_serializable and riverpod_generator, is banned. A hand-written LanguageController Notifier holds the current locale, and a locale-unique-key provider forces a full tree rebuild so the built-in translation getter actually refreshes.
The skill is explicit that single-locale apps keep hardcoded strings, because hardcoded strings have zero dev-cycle cost and migrating to slang later is mechanical. i18n runs on every platform the app already targets.
Frequently asked questions
Why only add i18n for two or more locales?
Hardcoded strings are simpler and cheaper during development, and slang adds a code-generation step. The kit treats i18n as opt-in and only advises adding it when an app truly ships multiple languages; migrating later is mechanical.
Does slang break the no-build_runner rule?
No. The kit bans build_runner except for slang i18n, which is the single documented exception. The generator is scoped to slang_build_runner, and no other code generator is allowed.
Get Flutter Agent Kit
Flutter Agent Kit ships this as a ready feature skill, together with the AGENTS.md context layer and the rest of the skills. €99.99 one-time, lifetime updates, unlimited personal and commercial projects.
Browse all features included in Flutter Agent Kit.