dimitriremoiville/cc-mobile/localization-arb

Claude Code and agent skill by dimitriremoiville/cc-mobile

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Flutter localization with ARB files + `flutter_localizations` + generated `AppLocalizations` — file layout, placeholder discipline, plurals, dates/numbers, runtime locale switching, CI gates. Load whenever adding or editing user-visible strings.

Install

npx vskill@latest install dimitriremoiville/cc-mobile/localization-arb

SKILL.md

The same SKILL.md was published earlier as dimitriremoiville/cc-mobile/localization-arb.

Localization (ARB)

File layout

lib/
l10n/
app_en.arb
app_fr.arb
app_es.arb
generated/ # generated by flutter gen-l10n (do not commit? — we do commit, for PR diffs)
l10n/
app_localizations.dart
app_localizations_en.dart
...

l10n.yaml at the project root:

yaml
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
output-class: AppLocalizations
nullable-getter: false
preferred-supported-locales: ["en", "fr", "es"]
synthetic-package: false
output-dir: lib/generated/l10n

pubspec.yaml:

yaml
flutter:
generate: true
dependencies:
flutter_localizations:
sdk: flutter
intl: any

Wire-up

dart
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
onGenerateTitle: (context) => AppLocalizations.of(context).appTitle,
)

No more S.of(context) / tr('key') in new code.

ARB discipline

app_en.arb is the source of truth. Every other locale mirrors its keys; missing keys fall back to English.

json
{
"@@locale": "en",
"appTitle": "Orders",
"@appTitle": { "description": "Root app bar title" },
"orderCount": "{count, plural, =0{No orders} =1{1 order} other{{count} orders}}",
"@orderCount": {
"description": "Count of orders on the home screen",
"placeholders": { "count": { "type": "int" } }
},
"welcomeBack": "Welcome back, {name}",
"@welcomeBack": {
"description": "Greeting on the home screen",
"placeholders": { "name": { "type": "String", "example": "Ada" } }
},
"orderPlacedAt": "Placed {date}",
"@orderPlacedAt": {
"description": "Relative timestamp for an order",
"placeholders": { "date": { "type": "DateTime", "format": "yMMMMd" } }
}
}
  • Every non-trivial key gets a description so translators understand context.
  • Placeholders declare a type (String / int / num / DateTime / double). The generator picks the right Intl method.
  • Plurals use ICU {count, plural, ...}. Covers English trivially; for languages with more plural categories (ar, ru, pl), translators add the categories their grammar needs.
  • Dates use ICU {date, date, yMMMMd} or the format attribute in the placeholder.

Use in widgets

dart
final l10n = AppLocalizations.of(context);
return Text(l10n.orderCount(orders.length));
  • AppLocalizations.of(context) caches per locale. Don't call it inside a tight loop — hoist.
  • Interpolate with the generated method, not ${l10n.greeting} $name. The generated plural/gender logic fires only through the method.

Runtime locale switching

Store the user-selected locale in settings, expose via a ChangeNotifier (or your repository of choice), and hoist into MaterialApp.locale:

dart
ValueListenableBuilder<Locale>(
valueListenable: settings.localeNotifier,
builder: (context, locale, _) => MaterialApp(
locale: locale,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: const HomeScreen(),
),
)

System locale by default; override only when the user explicitly picks one.

Numbers, currencies, dates

Avoid string concatenation. Use intl:

dart
NumberFormat.simpleCurrency(locale: Localizations.localeOf(context).toString()).format(totalCents / 100);
DateFormat.yMMMMd(Localizations.localeOf(context).toString()).format(date);

Consider registering a single IntlService in GetIt that wraps these so the formatting is testable and consistent.

CI gates

Fail CI when:

  1. A new key exists in app_en.arb but is missing in any translated file (or vice versa).
  2. A placeholder list diverges between locales.
  3. flutter gen-l10n produces a diff (translations out of sync with generated code).

A small tool/check_l10n.dart reads every .arb, compares key sets, and exits non-zero on drift.

RTL

Arabic, Hebrew, Persian — MaterialApp flips layout automatically when the locale's Directionality is rtl. Custom widgets with explicit Alignment.centerLeft or EdgeInsets.only(left:) break in RTL; use AlignmentDirectional.centerStart and EdgeInsetsDirectional.only(start:).

Testing

dart
testWidgets('shows localized greeting', (tester) async {
await tester.pumpWidget(
MaterialApp(
locale: const Locale('fr'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Builder(builder: (context) => Text(AppLocalizations.of(context).welcomeBack('Alice'))),
),
);
await tester.pumpAndSettle();
expect(find.text('Bon retour, Alice'), findsOneWidget);
});

Hard nos

  • No raw string literals in UI widgets. Everything user-visible through l10n.
  • No '${l10n.greeting} $name' — use a proper key with a placeholder.
  • No locale detection via Platform.localeName in UI layers — use Localizations.localeOf(context).
  • No committing an out-of-date generated/l10n/... — regenerate.
  • No missing placeholders in translated files. CI should catch this.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dimitriremoiville/cc-mobile/localization-arb/badge)](https://verified-skill.com/skills/dimitriremoiville/cc-mobile/localization-arb)

Something wrong with this skill or its page? Tell us.