Extension | .arb |
Smartling Identifier | arb |
Example File | (see example below) |
Resources |
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 examples of supported directives for ARB (Flutter):
Directive name | Values | Description | Example |
locale_format |
One or more of the following variables:
|
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)
|
smartling.locale_format =${locale.id} [${country.description}] |
placeholder_format |
|
Used to specify a standard placeholder format. |
smartling.placeholder_format = IOS Specifies iOS-style placeholders for the file. |
placeholder_format_custom |
|
Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder. See Placeholders in Resource Files for more on placeholders. |
smartling.placeholder_format_custom=\{([^}]+)\} Any characters surrounded by curly brackets, e.g., {first name}, will be treated as a placeholder. |
pseudo_inflation |
Integer values between 0 - 100 |
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. |
smartling.pseudo_inflation = 80 Downloaded pseudo translations will increase the length of original strings by 80 percent. |
string_format |
icu (default) NONE |
Parses the strings in this JSON file using ICU MessageFormat rules for placeholders, SelectFormat, PluralFormat. |
smartling.string_format=NONE |
whitespace_trim |
|
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 manage whitespace trimming. 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.
|
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 |