Preparing & Translating Supported File Types

ARB (Flutter)

 

Extension .arb
Smartling Identifier arb
Example File (see example below)
Resources

Internationalizing Flutter Apps

Application Resource Bundle (ARB) is a complex JSON file type. The file consists of key-value pairs with the following metadata information related to the key.

Example File

{

 "@@locale" : "en",

 "appName" : "Demo app",

 "pageLoginUsername" : "Your username",

 "@pageLoginUsername" : {},

 "pageHomeTitle" : "Welcome {firstName}",

 "@pageHomeTitle" : {

     "description" : "Welcome message on the Home screen",

     "placeholders": {

         "firstName": {}
     }

  },
"commonVehicleType": "{vehicleType, select, sedan{Sedan} cabriolet{Solid roof cabriolet} truck{16 wheel truck} other{Other}}",
"@commonVehicleType": {
"description": "Vehicle type",
"placeholders": {
"vehicleType": {}
}
}

Default Parsing 

In the above example:

  • "@@locale" = the locale ID for the language the content is in (not translatable)
  •  "appName" - service key (not translatable)
  • "pageLoginUsername" = the key value (translatable)
  • "@pageLoginUsername = the node key name metadata (not translatable)

The key values are translatable content, but the metadata or service keys are not. Meaning, for the example above the values for pageLoginUsername, pageHomeTitle are considered as translatable. @@locale and appName are service keys and their values are not translatable.

The key value is considered as an ICU string by default and will be parsed as ICU Message Format.

Parsing Options

The locale @@locale  value is replaced with the download locale on file download. By default, it is a standard locale name in a format 'll-CC'. This format can be changed with the smartling.locale_format` directive.

For example, the locale, de-DE, will be returned as  "@@locale" : "de-DE" by default.

  • Applying the directive smartling.locale_format = ${language.id}, will return it as "@@locale" : "de"
  • Applying the directive smartling.locale_format = ${language.id}_${country.id}, will return it as "@@locale" : "de_DE"

Keys/Variants

The node key name is considered as a variant/key. The key value also depends on the ICU parser. If the ICU string is a complex structure that produces several strings, each string will have a unique key based on the sequence of the basic key value and the internal ICU-generated key.

Examples

The string "Your username" is the string for translation and "pageLoginUsername" is the key/variant.

The key "commonVehicleType" will produce the following strings/keys:

String

Key

Sedan

commonVehicleType[vehicleType_sedan]

Solid roof cabriolet

commonVehicleType[vehicleType_cabriolet]

16 wheel truck

commonVehicleType[vehicleType_truck]

Other

commonVehicleType[vehicleType_other]

String Instructions

The "description" text of metadata (if any) is always ingested as a translator's instruction for the related parsed value. For instance, for the example above the ingested string for pageHomeTitle will include the following instruction:

String Instruction
Welcome {0} Welcome message on the Home screen

Excluding Strings

Excluding strings from translation within the line using a directive is not supported. However, you can exclude strings from translation within SMartling, after the file is uploaded. See Exclude Content from Translation and Restore Excluded Strings for more information. 

Plurals

The translation of ICU plurals is supported. See ICU MessageFormat for more information.

Standard Placeholder Format

See ICU MessageFormat for more information.

File Download Options

Translations can be downloaded as one file per language.

File Rewrite Support

All translatable values are considered rewritable.

File Imports

Translated files can be imported, using the unique keys. See Importing Translated Resource Files.

Directives

File directives are supported via our API (inline is not supported). Directives are specified in the following format:

API Parameter

smartling.[directive_name] = [value] 

Here are some examples of [directive_name], along with example values or paths.

placeholder_format

Values  NONE; C; IOS; PYTHON; JAVA; YAML; QT, RESX 
Description  Used to specify a standard placeholder format. 
Examples 

smartling.placeholder_format=ios

Specifies iOS-style placeholders for the file.

 

placeholder_format_custom

Values  1) Custom Java-compatible regular expression.
2) NONE - disables any current custom placeholders 
Description Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder. 
Examples 

smartling.placeholder_format_custom=\{([^}]+)\}

Any characters surrounded by curly brackets, e.g., {first name}, will be treated as a placeholder.

See Placeholders in Resource Files for more on placeholders.

whitespace_trim

Values 

on|yes|true or off|no|false or leading|trailing

The default value is on

Description 

A whitespace is any character or series of characters that represent horizontal or vertical space in typography. When rendered, a whitespace character is not a visible mark, but does occupy an area or space on a page.

Although whitespaces are necessary within a string (typically to separate words), unnecessary whitespaces can be found at the start of a string (leading) and at the end of a string (trailing).

With this directive, you can trim whitespaces, as it enables or disables whitespace trim management for the ingested strings.

By default, the leading and trailing whitespaces are trimmed.

You can choose to disable trimming or specify trimming for leading or trailing whitespaces.

The directive can be used inline or as the API request parameter.

Examples 

smartling.whitespace_trim=on

Smartling will trim leading and trailing whitespaces (default)

smartling.whitespace_trim=off

Smartling will not trim leading or trailing whitespaces

smartling.whitespace_trim=leading

Smartling will trim only leading whitespaces

smartling.whitespace_trim=trailing

Smartling will trim only trailing whitespaces

 

pseudo_inflation

Values integer - Accepted values are 0 - 100 
Description  Sets the percentage by which original strings are inflated when downloading pseudo translations. If this directive is not set, pseudo translations are 30 percent longer than the original strings. 
Examples 

smartling.pseudo_inflation = 80

Downloaded pseudo translations will increase the length of original strings by 80 percent.

 

 

string_format

Value  icu (default) | NONE
Description 

Parse the strings in this JSON file using ICU MessageFormat rules for placeholders, SelectFormat, PluralFormat.

Examples  smartling.string_format=NONE

 

locale_format

Values

One or more of the following variables:

${locale.id}
${language.id}
${country.id}
${language.description}
${country.description}

Description

Controls the locale ID associated with the "@@locale" value in the translated file.

For instance, for the fr-FR locale, the following format:

${language.description} (${country.description})

results in this header in the translated file:

French (France)

Examples

smartling.locale_format =${locale.id} [${country.description}]

Was this article helpful?