As files are processed during the upload and download, variables are populated allowing you to access certain information about the file that is currently being processed.
You can use variables to build output path for translated files, send data to server along with your files, for conditional upload/download or for transformations.
Variables are always used as ${variable_name}
. Only letters and the underscore symbol are allowed for variable names.
Value of the variable is always string.
Upload variables 🔗
These variables are available while the Localazy CLI is collecting files to be uploaded to server. During the upload process, you are about to infer additional parameters that you want to send to server from the file path and name.
Variable | Description |
---|---|
${file} |
The file name without the path. Eg. file.json |
${path} |
The path to the file without the file name itself. Eg. path/to/file |
${fullPath} |
The full path to file including the path and the file name. Eg. path/to/file/file.json |
${autodetectSuccess} |
Set to string true if auto-detection was successful and to false otherwise. |
${autodetectLang} |
Auto-detected locale if auto-detection is possible. |
${autodetectPath} |
Auto-detected path if auto-detection is possible. |
${autodetectFile} |
Auto-detected file if auto-detection is possible. |
${autodetectFileWithFallback} |
Auto-detected file if auto-detection is possible or return ${file} as a fallback. |
Download variables 🔗
These variables are available while the Localazy CLI is processing the downloaded translated files. Many of variables available at that moment are those you previously sent while uploading your files. For this reason, it’s necessary to upload files with the correct metadata.
Also, Localazy CLI calculates many other variables, so they are ready to use.
Variable | Description |
---|---|
${file} |
The file name without the path. Eg. file.json |
${path} |
The path to the file without the file name. Eg. /path/to/file |
${fullPath} |
The full path to file including the path and the file name. Eg. path/to/file/file.json |
${fileWithoutExt} |
The file name without the path and extension. Eg. file |
${fullPathWithoutExt} |
The full path to file without the extension. Eg. /path/to/file/file |
${fileExt} |
The file extension. Eg. json |
${groups} |
Space separated list of groups this file belonged too when uploaded. See groups for more information. |
${module} |
The module this file belongs to. See modules, libraries and product flavors for more information. |
${library} |
The library this file belongs to. See modules, libraries and product flavors for more information. |
${buildType} |
The build type this file belongs to. See modules, libraries and product flavors for more information. |
${productFlavors} |
Space separated list of product flavors this file belongs to. See modules, libraries and product flavors for more information. |
${types} |
Space separated list of types, eg. ios strings . See below for available types information. |
${languageCode} |
The code of the language, eg. zh . |
${regionCode} |
The code of the region, eg. TW . |
${scriptCode} |
The code of the script, eg. Hans . |
${langName} |
Language name in its own language, eg. Deutsch for de . If the language name is not known, English name is returned. |
${langNameEn} |
Language name in English, eg. German for de . |
${langRtl} |
Contains string true if the language is RTL (right-to-left), false otherwise. |
${langLocalazyId} |
The internal Localazy ID of the language. |
${androidFlavoredFolder} |
A folder name built up from product flavors and the build type. Eg. returns googleFreeDebug for build type debug and product flavors google and free . |
${iosLprojFolder} |
A folder name built up from language and .lproj string. Eg. en-US.lproj . |
${lang} |
The locale formatted as: LL, LL-RR, LL-SCRP, LL-SCRP-RR |
${language} |
The locale formatted as: LL, LL-RR, LL-SCRP, LL-SCRP-RR |
${langIosStrings} |
The locale formatted as: LL, LL_RR, LL-SCRP, LL-SCRP_RR |
${langAndroidResNoScript} |
The locale formatted as: LL, LL-rRR, LL, LL-rRR |
${langAndroidRes} |
The locale formatted as: LL, LL-rRR, b+LL+SCRP, b+LL+SCRP+RR |
${langAndroidBcp} |
The locale formatted as: b+LL, b+LL+RR, b+LL+SCRP, b+LL+SCRP+RR |
${langLrsUnderscore} |
The locale formatted as: LL, LL_RR, LL_SCRP, LL_RR_SCRP |
${langLsrUnderscore} |
The locale formatted as: LL, LL_RR, LL_SCRP, LL_SCRP_RR |
${langLrsDash} |
The locale formatted as: LL, LL_RR, LL-SCRP, LL-RR-SCRP |
${langLsrDash} |
The locale formatted as: LL, LL-RR, LL-SCRP, LL-SCRP-RR |
Locale formatting 🔗
In the table above, it’s described that you can obtain the locale in different formats.
The format is always consisted of 4 patterns separated with a comma and each of the patterns is used depending on available parts (language, region, script).
Examples for format LL, LL_RR, LL-SCRP, LL_RR-SCRP:
Language | Region | Script | Formatted |
---|---|---|---|
de | de | ||
cs | CZ | cs_CZ | |
zh | Hant | zh-Hant | |
zh | TW | Hans | zh_TW-Hans |
Examples for format b+LL, b+LL+RR, b+LL+SCRP, b+LL+SCRP+RR:
Language | Region | Script | Formatted |
---|---|---|---|
de | b+de | ||
cs | CZ | b+cs+CZ | |
zh | Hant | b+zh+Hant | |
zh | TW | Hans | b+zh+Hans+TW |
Types 🔗
For each file, its type is returned as a space separated list of several identifiers.
You can use them to conditionally process file using containsWord
condition.
File | Types |
---|---|
Flutter ARB | arb json |
JSON | json |
JSON - multilingual | json multilingual |
JSON - RequireJS | json requirejs |
Android (uploaded with Gradle) | android xml gradle |
Android (uploaded with CLI) | android xml upload |
iOS .strings | ios-strings ios strings |
iOS .plist | ios-plist ios plist |
iOS .stringsdict | ios-stringsdict ios stringsdict |
XLIFF 1.2 | xliff xml 1.2 |
XLIFF 2.0 | xliff xml 2.0 |
PO files | po gettext |
YAML | yaml |
YAML - Rails i18n | yaml lang-root |
YAML - multilingual | yaml multilingual |
RESX | resx xml |
JSON5 | json5 |
JSON5 - multilingual | json5 multilingual |
HJSON | hjson |
HJSON - multilingual | hjson multilingual |
JavaScript | js |
JavaScript - multilingual | js multilingual |
Java Properties | properties java |
INI files | ini |
INI files - multilingual | ini multilingual |
PHP | php |
PHP - multilingual | php multilingual |
Qt Linquist TS | qt-ts ts qt xml linquist |
Text | text single file |
CSV | csv |
CSV - multilingual | csv multilingual |
NEON | neon |
NEON - multilingual | neon multilingual |
TOML | toml |
TOML - multilingual | toml multilingual |
Excel | excel xls xlsx |
Excel - multilingual | excel xls xlsx multilingual |
OpenOffice ODS | ods openoffice |
OpenOffice ODS - multilingual | ods openoffice multilingual |
SRT Subtitles | srt subtitles subrip |