Pluralization, Gender, and ICU Message Formatting
Handle plurals, select cases, and parameterized strings using the ICU message syntax.
Why ICU Messages Matter
Translating an app is more than swapping words. Different languages pluralize, gender, and order words differently. A naive string like "$count items" reads wrong as "1 items", and many languages have several plural forms.
Flutter solves this with ICU message syntax (International Components for Unicode), the same standard used across the industry. You write one message with rules for plurals, select/gender, and placeholders, and the right form is chosen at runtime per locale.
plural— pick a form based on a numberselect— pick a branch based on a string (e.g. gender)- placeholders — inject typed values like names, dates, numbers
The ARB File: Where Messages Live
Flutter's flutter_localizations + intl toolchain reads ARB files (Application Resource Bundle). Each locale has its own file: app_en.arb, app_tr.arb, etc.
An ARB entry has a key, a value (the ICU message), and an optional @key metadata object describing placeholders.
- Keys become generated Dart getters/methods.
- The
@keyblock declares each placeholder'stypeand optionalformat.
{
"appTitle": "My Shop",
"@appTitle": {
"description": "The title shown in the app bar"
},
"welcome": "Welcome, {name}!",
"@welcome": {
"placeholders": {
"name": { "type": "String" }
}
}
}All lessons in this course
- ARB Files and gen_l10n Localization Workflow
- Pluralization, Gender, and ICU Message Formatting
- RTL Layouts and Directionality Handling
- Semantics, Screen Readers, and Accessible Widgets