0PricingLogin
Flutter Mobile Development · Lesson

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 number
  • select — 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 @key block declares each placeholder's type and optional format.
{
  "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

  1. ARB Files and gen_l10n Localization Workflow
  2. Pluralization, Gender, and ICU Message Formatting
  3. RTL Layouts and Directionality Handling
  4. Semantics, Screen Readers, and Accessible Widgets
← Back to Flutter Mobile Development