Documentation section

File Format - Flutter ARB

Learn how to use Localazy CLI for localization of Flutter app.

Flutter’s ARB format is fully supported including arrays, plurals, and selected context information. No extra configuration is necessary, but you can enable certain features if you want to.

Generate @@locale 🔗

Add arb_locale_full to features in the upload section to generate full locale. Example for cs_CZ:

{
  "@@locale": "cs_CZ"
}

Add arb_locale_lang to features in the upload section to generate language only. Example for cs_CZ:

{
  "@@locale": "cs"
}

Context information 🔗

Allows defining additional metadata for the string using @key notation.

By default, Localazy extracts content from description, context and placeholders and presents it to the translators to provide better context and improve translation quality.

For plurals and arrays, metadata can be defined using the base form without the suffix.

{

  "singleString": "This is just a normal string.",
  "@singleString": {
    "context": "views:Home page",
    "description": "Comment for the single string."
  },

  "datePickerMinuteOne": "1 minute",
  "datePickerMinuteOther": "$minute minutes",
  "@datePickerMinute": {    
    "description": "Accessibility announcement for the selected minute on a time picker such as '15 minutes' or '15分'",
    "plural": "minute",
    "placeholders": {
      "minute": {
        "description": "the number of minutes",
        "example": "15"
      }
    }
  }

}

Arrays 🔗

Arrays are good but beware of changing the number of items to prevent mismatching translations. If your files contain incomplete arrays, don’t use array features at all.

There are two ways how to define arrays.

JSON Arrays 🔗

Standard JSON arrays are recognized as arrays and stored with Localazy in a corresponding way.

This feature can be enabled by adding array to features in the upload section.

{
  "game.difficulty": [
    "easy",
    "medium",
    "hard"
  ]
}

Arrays defined by suffix 🔗

As using JSON arrays in ARB is not common, Localazy parses automatically also the suffixed variant shown below and presents it to translators in a way that keeps items together and thus improves context and translation quality.

This feature can be enabled by adding array_br to features in the upload section.

{
  "difficulty[0]": "easy",
  "difficulty[4]": "normal",
  "difficulty[7]": "hard",
  "difficulty[9]": "extreme"
}

The code above will be processed as an array and additional metadata will be stored, so Localazy can restore the indexes correctly.

All valid indexes are processed where valid index is non-negative integer value.

Plurals 🔗

Beware that plurals may lead to different output for translated files due to how plurals are handled in different languages.

// English has only two plural forms:
{
  "pluralOne": "You have 1 item.",
  "pluralOther": "You have %d items."
}

// Czech has three plural forms:
{
  "pluralOne": "Máte 1 položku.",
  "pluralFew": "Máte %d položky.",
  "pluralOther": "Máte %d položek."
}

Localazy knows the rules for different languages and adapt its interface to assist translators to correctly translate all mandatory forms.

Your app should be able to handle this. We are also working on SDK to help you with this task.

Allowed plurals types are: zero, one, two, few, many, other.

Suffixed with camelCase 🔗

This feature can be disabled by adding !plural_postfix_cc to features in the upload section.

Example:

{

  "camelCase": {
    "usersOne": "There is one user.",
    "usersOther": "There are $number users."  
  }

}

Suffixed with brackets 🔗

This feature can be disabled by adding !plural_postfix_br to features in the upload section.

Example:

{

  "brackets": {
    "users[one]": "There is one user.",
    "users[other]": "There are $number users."  
  }

}

Defined using ICU 🔗

This feature can be disabled by adding !plural_icu to features in the upload section.

{
  "users": "There are {COUNT, plural, one {one user} other {# users}}."
}

Only one ICU plural can be used in the string as otherwise, it wouldn’t be possible to convert it to a specific Localazy plural structure. If more than two ICU plurals are contained, the string is kept in the original form.

Allowed plurals types are: zero (=0), one (=1), two (=2), few, many, other.

Other ICU types like gender, number, etc. can be used but will not be converted and will be kept in string in the original form.

JSON parser compatibility 🔗

Our ARB parser is based on top of our JSON support and so you can additionally enable any other feature you need.

Filtering untranslated strings 🔗

By default, when the output file is generated, Localazy uses texts from the source languages when the translation in the exported language is missing.

This approach is safeguarding you from missing keys that can lead to crashes in some solutions/frameworks.

This feature can be disable by adding filter_untranslated to features in the upload section and reuploading your source language file.