fl-localization
Adds and updates app strings through the CSV → ARB → generated localizations workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Adds and updates app strings through the CSV → ARB → generated localizations workflow
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Behavioral guidelines for Flutter base tasks: clarify ambiguity, keep changes simple and surgical, and define verifiable success criteria before coding.
Scaffolds a new feature module under apps/main/lib/presentation/modules using the bundled module generator
Reviews UI-layer changes — screens, blocs, widgets, routes — against the template's StateBase + CoreBlocBase + fl_theme conventions
Awareness index of every reusable widget in fl_ui, fl_theme, fl_media, and core's common_widget — name, one-line purpose, when to reach for it instead of writing a new one
Builds the data layer with Freezed DTOs, Retrofit clients, the storage-seam local data manager, and repositories wired through injectable
Teaches and applies Flutter/Dart dependency injection with Injectable + GetIt, grounded in this repo's Clean Architecture and code generation conventions. Use when changing DI wiring, adding BLoCs/use cases/repositories/modules, using @Named/@preResolve/@factoryParam/env registrations, reviewing DI best practices, or setting up DI tests.
| name | fl-localization |
| description | Adds and updates app strings through the CSV → ARB → generated localizations workflow |
| license | MIT |
| metadata | {"audience":"flutter-developers","framework":"flutter","pattern":"localization"} |
The CSV files are the source of truth — never hand-edit generated ARB or localization Dart files.
Current supported locales:
en — primary/default localevi — secondary localeLocalization sources:
apps/main/lib/l10n/
├── localizations.csv # app source of truth: key,en,vi
├── intl_en.arb # generated from CSV
├── intl_vi.arb # generated from CSV
├── localization_ext.dart # context/app localization helpers
└── generated/
├── app_localizations.dart
├── app_localizations_en.dart
└── app_localizations_vi.dart
core/lib/l10n/
├── localizations.csv # shared core strings: key,en,vi
├── intl_en.arb
├── intl_vi.arb
└── generated/
├── core_localizations.dart
├── core_localizations_en.dart
└── core_localizations_vi.dart
plugins/fl_media/lib/src/l10n/
├── localizations.csv # media plugin strings: key,en,vi
├── intl_en.arb
├── intl_vi.arb
└── generated/
├── fl_media_localizations.dart
├── fl_media_localizations_en.dart
└── fl_media_localizations_vi.dart
Each package has an l10n.yaml; the root make lang target regenerates all three localization sets:
make lang
That runs the custom CSV → ARB generator and then Flutter gen-l10n for apps/main, core, and plugins/fl_media.
The header is currently key,en,vi. One row per string.
key,en,vi
inform,Inform,Thông báo
ok,Ok,Đồng ý
loginRequired,Please login to continue,Vui lòng đăng nhập để tiếp tục
welcomeMessage,"Welcome, {0}!","Xin chào, {0}!"
Rules:
loginRequired, not auth_msg_2).{0}, {1}, …); do not use named placeholders.poweredByVNS → poweredByApp.apps/main/lib/l10n/localizations.csvcore/lib/l10n/localizations.csvplugins/fl_media/lib/src/l10n/localizations.csvDo not duplicate a shared string into app CSV if it already belongs in core or fl_media.
In app screens, use the generated app localizations helper:
class _FeatureScreenState extends StateBase<FeatureScreen> {
late AppLocalizations trans;
@override
Widget build(BuildContext context) {
trans = translate(context);
return ScreenForm(title: trans.featureTitle, child: ...);
}
}
Outside a StateBase or in a child widget, use the BuildContext extension/helper already present in that package:
import '<path>/l10n/localization_ext.dart';
@override
Widget build(BuildContext context) {
return Text(context.l10n.welcomeMessage('Huy'));
}
For shared core strings, use the existing core localization accessors from core/lib/l10n/. For fl_media, use FlMediaLocalizations through its package localization helper/delegate.
Locale infrastructure lives in:
core/lib/common/constants/locale/app_locale.dartapps/main/lib/app_delegate.dartapps/main/lib/presentation/app.dartcore/lib/common/calendar.dartcore/lib/presentation/extentions/context_extention.dartMaterialApp.supportedLocales is wired from AppLocale.supportedLocales, not directly from generated app localizations. When changing the locale set, update AppLocale, app bootstrap locale messages, date/calendar helpers, and all three CSV files.
key,en,vi,ja.core/lib/common/constants/locale/app_locale.dart and supportedLocales.apps/main/lib/app_delegate.dart if the locale needs timeago/date messages.make lang.intl_<locale>.arb and *_localizations_<locale>.dart for each affected package.For sending app strings out to translators and folding results back, the template ships:
make gen_translation — emits a CSV with status columns ready for translators.make apply_translation — folds the completed CSV back into apps/main/lib/l10n/localizations.csv.See:
tools/module_generator/bin/generate_translation_csv.darttools/module_generator/bin/apply_translation.dartAfter localization changes, run:
make lang
rg -n "Locale\('th'|intl_th|_th\.dart|AppLocale\.th|ThMessages" .
Adjust the search terms when removing or replacing a different locale.
For app-facing strings, also run at least:
cd apps/main
fvm flutter analyze --no-pub
If shared/core strings changed, analyze core; if media strings changed, analyze plugins/fl_media.
apps/main, core, or fl_media).en and vi.*.arb or *_localizations_*.dart files.make lang run and generated files updated.{0}, {1} placeholders.intl_en.arb or intl_vi.arb directly — the next make lang overwrites it.core or fl_media localization.intl_th.arb, *_th.dart) after replacing a locale.localizations.csv because only the widget code was removed.{name} placeholders — use positional {0}.Text('Save') for user-facing text.