/flutter:i18n-rtl-l10nfrom Flutter Skills
Enforces gen-l10n/ARB localization contract for Flutter apps: directional-only geometry, ICU plural/select, nullable-getter:false, vendored delegates for unsupported locales. Use when adding ARB keys, building RTL screens, or formatting dates/numbers.
Ships in Flutter Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
One contract: store canonical, localize at render. Every conversion and formatting lives in
one l10n layer; feature widgets receive value objects and already-localized strings, never raw
formatting logic. RTL is a layout discipline, not a translation task — author with logical
geometry so it mirrors by construction. Applies to any app that ships more than one locale or any
RTL locale (Arabic, Persian, Hebrew, Sorani Kurdish, Urdu).
Read the reference for the task at hand:
references/arb-and-icu.md — the ARB add/translate workflow, l10n.yaml, ICU plural/select, placeholder typing.references/rtl-and-bidi.md — the directional-geometry allow/ban table, icon mirroring, bidi isolation, CustomPainter pinned LTR, RTL charts.references/numerals-and-calendars.md — digit systems, separator traps, format/parse, calendar projection.references/unsupported-locales.md — shipping a locale flutter_localizations has no data for: the probe, the vendored delegate trio, delegate ordering, font coverage.Run scripts/check_arb_parity.sh and scripts/check_i18n_bans.sh before a PR.
app_en.arb
first, then read it via AppLocalizations.of(context). Set nullable-getter: false in
l10n.yaml so the getter is non-null and a missing/typo key is a compile error, not a
silent empty widget. Never hardcode a literal in Text, tooltip:, label:, hint:, or
semanticsLabel:. Never call AppLocalizations.of above the Localizations scope (e.g. in
main() before runApp).{placeholder} name identical — check_arb_parity.sh gates it.{count, plural, ...} and
{x, select, ...} in the ARB. Word order and plural categories differ per language (Arabic has
six CLDR forms: zero/one/two/few/many/other). Concatenation produces grammatically wrong output
and can't survive RTL reordering.localizationsDelegates +
supportedLocales on MaterialApp and drive the active locale from state. A root
Directionality(TextDirection.rtl) hides physical-side bugs and breaks LTR islands. RTL follows
the resolved locale via GlobalWidgetsLocalizations with zero per-widget code — but only for
locales flutter_localizations actually ships (rule 10). For any other, direction silently
falls back to LTR. Assert Directionality.of per locale rather than assuming.EdgeInsetsDirectional,
AlignmentDirectional, PositionedDirectional, TextAlign.start/end,
MainAxisAlignment.start/end, BorderRadiusDirectional, Icons.adaptive.*. Never
EdgeInsets.only(left/right), Alignment.centerLeft/Right, Positioned(left/right:),
TextAlign.left/right, or Icons.arrow_back. A grep gate rejects the PR.dateTime.toUtc().millisecondsSinceEpoch
and Western/Latin digits. Calendars and numeral systems are pure display projections. Schedule
off the epoch/DateTime, never off Jalali/Hijri arithmetic — leap/month-length quirks stay
calendar-independent.double.parse(normalizeToAscii(text)); never int.parse(text) on raw input (a Persian/Arabic
soft keyboard yields ۱۲۳ / ١٢٣ and 1٫5).U+2066–U+2069) reach storage, search, or export — strip at the boundary.fontFamily plus fontFamilyFallback so Arabic/Persian glyphs never tofu. Avoid google_fonts
in an offline/no-telemetry app — it fetches at runtime. Prove coverage from the font's own
cmap, not a specimen: script coverage is not language coverage — a face that draws Persian
can be missing the seven letters Sorani adds, and a specimen set in Arabic never shows it.flutter_localizations does not ship needs three vendored delegates, ordered
first. gen-l10n localizes your strings; Flutter's own chrome and the ambient TextDirection
come from a different catalog. Vendor MaterialLocalizations, CupertinoLocalizations and
WidgetsLocalizations borrowing a script neighbour, each claiming only that language code, and
place them ahead of the Global* delegates — which AppLocalizations.localizationsDelegates
already contains. WHY: the missing Material delegate asserts on the first Tooltip, and the
Widgets fallback claims every locale while hardcoding TextDirection.ltr, so fixing only the
Material half yields an RTL app that reads backwards and never crashes.
See references/unsupported-locales.md.@key metadata (typed placeholders, a description for translators) to the
template app_en.arb.scripts/check_arb_parity.sh — fails on any missing/extra key or placeholder mismatch.flutter gen-l10n) and flutter analyze — a missing key is now a compile error.// app_en.arb (template) — declare the key + @metadata here first.
{
"@@locale": "en",
"itemsRemaining": "{count, plural, =0{No items left} =1{1 item left} other{{count} items left}}",
"@itemsRemaining": {
"description": "Count shown on the order summary card.",
"placeholders": { "count": { "type": "int" } }
}
}
// app_ar.arb — same key; Arabic's SIX CLDR categories are a translation contract.
{
"@@locale": "ar",
"itemsRemaining": "{count, plural, zero{لا عناصر متبقية} one{عنصر واحد متبقٍ} two{عنصران متبقيان} few{{count} عناصر متبقية} many{{count} عنصرًا متبقيًا} other{{count} عنصر متبقٍ}}"
}
// Reads correctly under LTR and RTL with zero conditionals.
Padding(
padding: const EdgeInsetsDirectional.only(start: 16, end: 8), // never left/right
child: Row(
children: [
Expanded(child: Text(task.title, textAlign: TextAlign.start)), // never .left
IconButton(
icon: Icon(Icons.adaptive.arrow_forward), // auto-mirrors in RTL
onPressed: onNext,
),
],
),
)
Mirror direction-implying glyphs (back/next, chevrons, progress carets) via Icons.adaptive.*.
Never mirror fixed-meaning glyphs (clock, checkmark, media play/pause, logos). See
references/rtl-and-bidi.md for the full allow/ban table and manual-flip recipe.
Use each locale's own NumberFormat: intl emits native digits from the locale's symbol data, not
from a -u-nu- extension (it drops the unicode -u extension during fallback). Locales intl has
no number symbols for (e.g. ckb) silently fall back to Latin, so pin those to a covered base locale
that shares the numbering system (ckb→fa) and assert the emitted digit block in a test. The same
formatter feeds chrome AND any canvas painter.
// One formatter per locale. Persian and Arabic digits are DISTINCT Unicode blocks
// (۴۵۶ U+06Fx vs ٤٥٦ U+066x) — not interchangeable. Format with a locale intl ships
// symbols for; a `-u-nu-` extension is dropped, not honored.
NumberFormat numberFormatFor(Locale locale) => switch (locale.languageCode) {
'fa' => NumberFormat.decimalPattern('fa'), // ۰۱۲۳۴۵۶۷۸۹ (arabext)
// ckb has no intl number symbols — borrow fa (same arabext block + separators).
'ckb' => NumberFormat.decimalPattern('fa'),
'ar' => NumberFormat.decimalPattern('ar'), // ٠١٢٣٤٥٦٧٨٩ (arab)
_ => NumberFormat.decimalPattern('en'), // Western (en, de, fr)
};
Normalize before any parse — fold both digit ranges AND the Persian/Arabic separators:
String normalizeToAscii(String input) {
final sb = StringBuffer();
for (final r in input.runes) {
if (r >= 0x0660 && r <= 0x0669) { // Eastern-Arabic ٠-٩
sb.writeCharCode(0x30 + (r - 0x0660));
} else if (r >= 0x06F0 && r <= 0x06F9) { // Persian ۰-۹
sb.writeCharCode(0x30 + (r - 0x06F0));
} else if (r == 0x066B) { // ٫ decimal separator -> '.'
sb.write('.');
} else if (r == 0x066C) { // ٬ grouping separator -> drop
continue;
} else {
sb.writeCharCode(r);
}
}
return sb.toString();
}
// double.parse(normalizeToAscii(text)) — never int.parse on raw input.
1٫5 means 1.5, not 15: normalizing digits but not separators silently corrupts entered amounts.
Full digit/separator/calendar tables: references/numerals-and-calendars.md.
const _lri = ''; // LEFT-TO-RIGHT ISOLATE
const _rli = ''; // RIGHT-TO-LEFT ISOLATE
const _fsi = ''; // FIRST STRONG ISOLATE (unknown direction)
const _pdi = ''; // POP DIRECTIONAL ISOLATE
String isolate(String run) => '$_fsi$run$_pdi'; // unknown direction
String isolateLtr(String run) => '$_lri$run$_pdi'; // known LTR (codes, numbers)
String isolateRtl(String run) => '$_rli$run$_pdi'; // known RTL
// Prefer known-direction over FSI: first-strong mis-guesses on leading punctuation.
// The isolated value is an ARB placeholder, never a hard-spliced substring:
Text(l10n.orderRef(isolateLtr(order.reference))); // "{ref} — order" reads correctly in RTL
Isolate at the view layer only. For a standalone field, set direction on the widget instead:
Text(code, textDirection: TextDirection.ltr, textAlign: TextAlign.end). Never use legacy
LRE/RLE/LRO/RLO embeddings — use the isolate controls (UAX #9).
Project a stored UTC instant into the user's chosen calendar for display only. Never persist a
calendar-specific field; never hand-roll Jalali/Gregorian conversion (use intl, shamsi_date,
hijri). First-day-of-week and weekend are locale-aware — compute buckets on canonical dates,
label per locale. See examples/numeral_normalizer.dart and references/numerals-and-calendars.md.
If a painter owns a fixed coordinate grid, pin only that subtree to
Directionality(textDirection: TextDirection.ltr, …) so ambient RTL cannot flip the geometry;
chrome around it still mirrors via logical insets. Map pointers through the painter's own transform
on localPosition — never invert dx for RTL. Feed the painter the same numberFormatFor(locale)
so on-canvas numerals match the chrome. Chart chrome (axes, legend, time axis) mirrors, but the
plotted data itself never flips. Details in custom-canvas-and-gestures.
Text('Order details') — a hardcoded literal with no gen-l10n route. Read l10n.orderDetails.
(A precise hardcoded-UI-string grep is false-positive-prone, so this one is caught in review, not by
check_i18n_bans.sh — that gate covers geometry, icons, number splices, legacy bidi, and font fetch.)en and nullable-getter: false makes a missing key a compile error.count == 1 ? 'item' : 'items' — a two-way ternary can't hold Arabic few/many; use ICU plural.Text('$count items') or 'Total ' + n.toString() — concatenated fragments + raw ASCII digits;
wrong word order in RTL and wrong digit block. One ICU message + numberFormatFor.٤٥٦ (Arabic-Indic) or Arabic showing ۴۵۶ (Extended Arabic-Indic) — distinct
Unicode blocks; format via the fa formatter for fa/ckb and the ar formatter for ar.EdgeInsets.only(left: 16) / Alignment.centerLeft / Positioned(left:) — physical sides bypass
mirroring (fails the grep).Directionality(TextDirection.rtl) to "turn on RTL" — RTL comes from the
locale; a hardcoded root hides physical-side bugs and breaks LTR islands.[...AppLocalizations.localizationsDelegates, GlobalMaterialLocalizations.delegate, …] — that
spread already contains the three Global* delegates, so re-appending them duplicates them
and puts them ahead of any delegate you vendor. Localizations._loadAll takes the first delegate
of a type that claims the locale; yours is never reached.MaterialLocalizations delegate for an unsupported locale — the crash goes away
and the app renders backwards instead. Vendor the WidgetsLocalizations one too, or neither.cmap.U+2066–U+2069) reach storage/search/export — strip at the boundary.Ahem — Persian digits and Arabic-script shaping are never
exercised. Load real bundled fonts (see widget-golden-and-a11y-testing).int.parse(userText) on a raw numeric field — normalize to ASCII first.app_en.arb with @description + typed placeholders; every other
locale has the same key; check_arb_parity.sh passes.nullable-getter: false; string read only through AppLocalizations; no literal in
Text/tooltip/label/hint/semanticsLabel.plural (all six Arabic categories where Arabic ships); no
ternary, no $count splice.numberFormatFor(locale) / intl DateFormat, injected as
placeholders — never hand-formatted ASCII, never the wrong digit block; a painter shares the
same formatter.normalizeToAscii before parse/store; round-trip tested.start/end, Icons.adaptive); no physical-side API survives
the grep; direction comes from the locale, not a hardcoded root Directionality.LRE/RLE; isolates never reach storage.cmap — the language's own letters,
not just its script.flutter_localizations or has all three delegates vendored
ahead of the Global* ones; Directionality.of and a MaterialLocalizations string are
asserted for each; platform manifests (CFBundleLocalizations) list every tag.accessibility-as-code for Semantics roles/labels and reading a11y state from MediaQuery.widget-golden-and-a11y-testing for the RTL/numeral golden lanes (real fonts, not Ahem) and
the textScaler overflow matrix.custom-canvas-and-gestures for the LTR-pinned painter, shared transform, and pointer mapping.value-objects-money-and-units for canonical integer-minor-unit storage rendered here.local-notifications-scheduler for scheduling off canonical instants, not calendar arithmetic.widget-composition for the directional layout primitives these strings sit inside.scaffold-feature-module for wiring a new feature's strings through this ARB workflow.design-system-structure (references/typography-and-fonts.md) for where the per-script
fallback cascade is declared and how bundled glyph coverage is proved.app-startup-and-bootstrap for restoring the persisted locale before the first frame — the
only way a locale the OS cannot select is ever reachable.l10n.yaml options: https://docs.flutter.dev/ui/accessibility-and-internationalization/internationalization#configuring-the-l10nyaml-fileMessageFormat (plural/select): https://unicode-org.github.io/icu/userguide/format_parse/messages/intl package (NumberFormat, DateFormat, Bidi): https://pub.dev/packages/intlDirectionality, EdgeInsetsDirectional: https://api.flutter.dev/flutter/widgets/Directionality-class.htmlLocalizationsDelegate (vendoring one): https://api.flutter.dev/flutter/widgets/LocalizationsDelegate-class.htmlcmap table (glyph coverage): https://learn.microsoft.com/en-us/typography/opentype/spec/cmapexamples/directional_widget.dart (opens in a new tab)examples/numeral_normalizer.dart (opens in a new tab)examples/unsupported_locale_delegates.dart (opens in a new tab)references/arb-and-icu.md (opens in a new tab)references/numerals-and-calendars.md (opens in a new tab)references/rtl-and-bidi.md (opens in a new tab)references/unsupported-locales.md (opens in a new tab)scripts/check_arb_parity.sh (opens in a new tab)scripts/check_i18n_bans.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
flutter-localization, arb, rtl, icu-messages, applocalizations
npx claudepluginhub zakariaf/flutter-skills --plugin flutter40 skills in this plugin
/accessibility-as-codeEnforces accessibility as a correctness property authored into each widget — Semantics(button/label) or ExcludeSemantics on every node, a11y state read from MediaQuery not app state, never MediaQuery.withClampedTextScaling / textScaleFactor / FittedBox / TextOverflow.ellipsis to fit a label, non-color redundant channels (icon+label+shape+text) for every state, contrast against composited backgrounds (4.5:1 body / 3:1 large), 44px single-tap targets, OrdinalSortKey traversal, and honoring boldText / reduce-motion. Use when adding a GestureDetector/InkWell or any tap target, adding an Icon or Image, reaching for withClampedTextScaling/FittedBox/ellipsis/textScaleFactor to make text fit, encoding state via color, sizing type, ordering focus traversal, or reviewing any View for screen-reader/switch/low-vision support./adaptive-layoutEnforces adapting layout by available CONSTRAINTS/size, never device or platform checks — LayoutBuilder + MediaQuery.sizeOf/paddingOf/viewInsetsOf (not .of) for narrow rebuilds, Material 3 window size classes (compact <600, medium 600-840, expanded 840-1200, large >1200) as the breakpoint vocabulary, navigation affordance chosen by width (NavigationBar → NavigationRail → NavigationDrawer), list-detail single-pane-vs-two-pane, readable max-width via ConstrainedBox, Flexible/Expanded/FractionallySizedBox over fixed widths, SafeArea + display cutouts + keyboard insets, never lock orientation, foldable/hinge awareness via MediaQuery.displayFeatures, and golden-matrix verification across sizes. Use when building responsive or adaptive UI, tablet/desktop/foldable support, master-detail or two-pane screens, a NavigationRail-vs-BottomNav shell, breakpoints, LayoutBuilder, MediaQuery sizing, SafeArea/cutouts, or fixing overflow at large widths./ads-and-iap-monetizationEnforces opt-in, rewarded-first monetization over the service seam — a rewarded view grants exactly one benefit and only on a genuine reward outcome (a sealed Rewarded/Dismissed/NoFill), earn loops capped per day against an injected Clock, the earn control preloaded and hidden unless an ad is loaded so a fresh account never dead-ends on "no ads available" (a Guideline 2.1 risk), interstitials only at a natural break under a count-and-elapsed cap owned by the service so callers stay dumb, no banner on the primary work surface, one non-consumable unlock plus Restore re-checked each launch and committed through the single write path before the UI reacts, one derived isEntitled provider as the only gate, and the entitlement restored BEFORE the ad SDK initializes so a paying user never starts it, resolves consent, or sees a tracking prompt. Use when adding ads, wiring a rewarded earn loop, placing an interstitial, building a paywall, gating an entitlement, or setting up ad units./app-startup-and-bootstrapEnforces a fixed main() cold-launch order — crash-log sink + FlutterError.onError + PlatformDispatcher.onError installed BEFORE any code that can throw, settings/theme read before runApp so the first frame paints correct, real infra constructed in a composition-root bootstrap() and injected via ProviderScope overrideWithValue over throwing placeholder providers, non-blocking warm-up deferred to addPostFrameCallback, exactly two error handlers with NO runZonedGuarded, ProviderException unwrapped before logging, and a WidgetsBindingObserver that flushes durable state on background/resume. Use when editing lib/main.dart, main_<flavor>.dart, bootstrap.dart or app.dart, reordering anything in main(), adding a splash/onboarding/permission gate, restoring theme before first paint, wiring a DB or service into ProviderScope, handling app-lifecycle background/resume flushes, or chasing cold-start latency, ANRs, or first-frame jank./async-safetyEnforces no-silent-failure async discipline in Flutter/Dart — the arrow-callback Future-drop hole no lint catches (`onTap: () => vm.save(x)`), void-returning event handlers, a mounted/ref.mounted guard after EVERY await before touching BuildContext, capturing Navigator/ScaffoldMessenger before the gap, honest `unawaited()` that always ends in catchError, no empty/bare catches, `rethrow` over `throw e`, and disposing every StreamSubscription/StreamController/Timer/sink. Use when writing or reviewing async/await, wiring onTap/onPressed/onSubmitted or any VoidCallback, touching BuildContext after an await, writing initState/dispose/addPostFrameCallback, adding a Timer or Future.delayed, writing a try/catch, or seeing use_build_context_synchronously, cancel_subscriptions, close_sinks, unawaited_futures, or discarded_futures./ci-pipeline-and-gatesEnforces a lean GitHub Actions Flutter CI where every gate maps to one named release-blocking contract — pinned runner + subosito/flutter-action@v2 toolchain, dart format --set-exit-if-changed, flutter analyze --fatal-infos, build_runner and drift schema freshness (git diff --exit-code), flutter test --test-randomize-ordering-seed random, static import/banned-string greps that catch what runtime can't, coverage-as-report-never-a-gate with the upward-lie fixed, verify-never-bless goldens (no --update-goldens in CI), and an honest statement of what CI cannot prove (audio, real fonts, on-device behaviour). Use when editing .github/workflows/*.yml, adding or removing a job or step, wiring a codegen/schema/format/analyze/coverage gate, writing a grep-based policy test or gate script under test/policy or tool/, pinning action versions, or claiming CI proves something it can't.Other plugins' skills for the same job