- Home
- Skills
- Kaakati
- Rails Enterprise Dev
- Internationalization Patterns
internationalization-patterns_skill
- Shell
6
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill kaakati/rails-enterprise-dev --skill internationalization-patterns- SKILL.md14.0 KB
Overview
This skill provides a concise, opinionated pattern set for implementing internationalization (i18n) and localization (l10n) in Flutter apps using GetX Translations. It covers translation organization, runtime locale management, RTL handling, formatting, pluralization, and testing to deliver robust multi-language UX. The guidance is practical and ready to plug into an enterprise Flutter codebase.
How this skill works
It defines a central Translations class for GetX that maps locale identifiers to keyed string maps, and shows how widgets consume keys via .tr and .trParams. The skill includes runtime locale switching with persistence (GetStorage), RTL detection and automatic Directionality, and helpers for date/number formatting with the intl package. It also gives patterns for pluralization, hierarchical key naming, and test coverage to ensure parity across languages.
When to use it
- Building a Flutter app that must support multiple languages and regions
- Needing runtime language switching with persisted user preference
- Supporting RTL languages (Arabic, Hebrew) while keeping layout adaptable
- Ensuring consistent date, number, and currency formatting per locale
- Validating translation completeness across languages in CI tests
Best practices
- Use hierarchical dot-separated keys and define constants for frequently used keys
- Persist user locale and fallback to device locale when no user preference exists
- Avoid hardcoded strings in widgets; prefer .tr and .trParams with placeholders
- Use intl for date/number/currency formatting and cache heavy formatters if needed
- Prefer directional widgets (EdgeInsetsDirectional, AlignmentDirectional) and test with RTL locales
- Write tests that compare key sets across languages to catch missing or extra keys
Example use cases
- AppSettings screen with a language dropdown that calls Get.updateLocale and saves selection to GetStorage
- Login and profile screens using TranslationKeys constants and .tr to avoid hardcoded text
- Displaying user-facing counts with pluralization helpers and trParams for @count
- Automatic layout flipping for Arabic by wrapping GetMaterialApp.builder with Directionality driven by an isRTL check
- Formatting invoices and receipts with NumberFormatter.formatCurrency and DateFormatter.formatDateTime for the current locale
FAQ
Add a new locale map to the Translations keys, provide translated strings for all reference keys, add a dropdown option and a country mapping, and update tests to include the new language.
How should I handle missing keys at runtime?
Provide a reliable fallbackLocale in GetMaterialApp and run the translation key parity test to catch missing keys before release; consider logging missing keys in development.