File formats

Flutter ARB

Application Resource Bundle files for Flutter's gen_l10n, with ICU plural messages and per-key descriptions.

FormatIdentifierExtension
Flutter ARBflutter_arb.arb

ARB is JSON with metadata members: @@locale names the file's locale, and @key holds metadata about key.

lib/l10n/app_fr.arb
{
  "@@locale": "fr",
  "greeting": "Bonjour, {name} !",
  "@greeting": {
    "description": "Shown at the top of the home screen."
  },
  "itemCount": "{count, plural, one{{count} article} other{{count} articles}}"
}

Keys

Each member whose name does not start with @ is a key, and its name is the key name. Values must be strings.

  • @@locale is checked against the locale you are importing; a mismatch is accepted with a warning. Other @@ members are ignored.
  • @key.description becomes the key's description. Other metadata, such as placeholders, is not read.
  • A @key with no matching key is accepted with a warning.

Plurals

A value shaped like an ICU plural message, {variable, plural, category{...} ...}, is imported as a plural key, with one form per category. Any variable name is accepted. Braces nest inside a form (one{{count} article}), and ICU apostrophe quoting is understood.

  • Every category must be one the locale uses. few in an English file is an import error. A category the file leaves out is stored empty.
  • A plural message with an exact-value selector, such as =0{No items}, is kept whole as an ordinary string, so its =N branches are not lost. The same goes for select messages. Either way the message is written back exactly as it came in.
  • A value that is not a plural message is an ordinary string.

On export, a plural key is written as {count, plural, ...} with the locale's categories in order. The variable is always count.

Placeholders

Placeholders such as {name} and {count} are kept as written. Inside plural forms, any other literal brace is written with ICU quoting ('{', '}'), and an apostrophe is doubled (''), so a form can never break the message structure. Import decodes the same quoting.

Export

  • @@locale comes first and is the exported locale.
  • Keys follow in byte order, each followed by @key with its description when the key has one.
  • Two-space indentation, one trailing newline.
  • Untranslated keys are left out.

Because only description is written to @key, other metadata from your files (such as placeholders declarations) is not in an export. Keep your template ARB (the source-language file gen_l10n reads metadata from) as a file you edit yourself, and pull only the target locales.

Runtime delivery

flutter_arb is one of the four delivery formats the runtime SDKs read, and the only one of them that carries plural keys. See Delivery formats.

On this page