Skip to main content
Flutter .ARB

Learn about localizing Application Resource Bundle (.arb) files with Transifex

P
Written by Product Team
Updated over a week ago

File Extension(s)

.arb

i18n type(s)

ARB

ARB is a format for translatable text resources in software projects written in Flutter. This format is based on JSON, a multi-level dictionary consisting of key-value pairs.


Sample data

{
"@@locale" : "en",
"appName" : "Demo app",

"pageLoginUsername" : "Your username",

"pageLoginPassword" : "Your password",

"pageHomeTitle" : "Welcome {firstName}",
"@pageHomeTitle" : {
"description" : "Welcome message on the Home screen",
"context": "HomePage",
"placeholders": {
"firstName": {}
}
}
}

ARB file structure

Simple key-value pairs

Key-value pairs on the root level where the “key” does not start with the “@” symbol are subject to text translation, and the “value” part is the text to translate.

"pageLoginUsername" : "Your username"

Key-value pairs with metadata

Key-value pairs on the root level where keys start with the “@” symbol carry additional metadata (e.g. some attributes) for another referenced key-value pair. The latter has the same key without the leading "@" symbol.

"pageHomeTitle" : "Welcome to my page!",
"@pageHomeTitle" : {
"description" : "Welcome message on the Home screen",
"context": "This text appears on the homepage"
}
  • "description": This text is displayed as 'Developer Notes' beneath the source string.

  • "context": This text appears as 'Context' in the string's context area.

The pair with the "@" key does not necessarily come right after the respective pair (for which metadata is intended) with the non-@ key in the ARB file. The @-key pair may be placed before or after the respective pair with the non-@ key in the file. Other key-value pairs may be placed between these two pairs. Any order and any placement is allowed.

📝 Note: If the metadata of a key-value pair contains the "type" attribute and this attribute is set to "text," then the value of the key-value pair is translatable.

"title-bar": "My Cool Home",
“@title-bar”: {
“type”: “text”,
“context”: “HomePage”,
“description”: “Page title.”

It is not translatable in all other cases, e.g., when the "type" is "image" or "CSS."

Key-value pairs with placeholders

If a key-value pair contains placeholders, these are preserved during parsing and shown as such in Transifex Editor.

"pageHomeTitle" : "Welcome {firstName}",
"@pageHomeTitle" : {
"context" : "Welcome message on the Home screen",
"placeholders": {
"firstName": {}
}
}

To ensure these placeholders are preserved during translation, you can configure them as custom variables, as described in our Help Center article here.

ICU plurals support

Plurals in ICU format are supported by the ARB parser. Both word syntax (“zero”, “one”, “two”, “few”, “many”, “other”) and numeric syntax (“=0”, “=1”, “=2”) in plural rules are allowed.

Word Syntax

"pageHomeInboxCount" : "{count, plural, one{You have 1 new message} other{You have {count} new messages}}",
"@pageHomeInboxCount" : {
"context" : "New messages count on the Home screen",
"placeholders": {
"count": {}
}
}

Numeric Syntax

"pageHomeInboxCount" : "{count, plural, =1{You have 1 new message} other{You have {count} new messages}}",
"@pageHomeInboxCount" : {
"context" : "New messages count on the Home screen",
"placeholders": {
"count": {}
}
}


Download modes

  • Download file to translate: Any untranslated entries will be returned empty so that translators know which untranslated ones they need to work on.

  • Download for use: Any untranslated entries will be returned in the source language.

  • Download only reviewed translations: Any untranslated string or unreviewed translation will be returned empty. Only strings with the status "Reviewed" are returned.

  • Download for translation as XLIFF: The file will be generated in the .xliff format and include both translated/reviewed and untranslated strings. The latter ones will be returned without containing target elements.

  • Download untranslated strings as XLIFF: The translation file will be generated in the .xliff format and include only the untranslated strings without containing target elements.

  • For more information on download modes via the API or Client, consult the following table:


💡Tip

Looking for more help? Get support from our Transifex Community Forum!

Find answers or post to get help from Transifex Support and our Community.

Did this answer your question?