Advanced Usage
Using CLI with Proxy Server​
Crowdin CLI provides the possibility to work with a proxy server. Each time you run a command, Crowdin CLI checks whether the operating system has the configured environment variables.
Supported environment variables:
HTTP_PROXY_HOST
- the name or the IP address of the host at which the proxy server is locatedHTTP_PROXY_PORT
- the port used by the proxy server for listeningHTTP_PROXY_USER
- the username used for authentication on a proxy serverHTTP_PROXY_PASSWORD
- the password used for authentication on a proxy server
Attach labels to the uploaded strings​
There are a few ways to attach labels to the uploaded strings using the Crowdin CLI:
Specify labels for each file-group in the
crowdin.yml
configuration file:crowdin.ymlfiles: [
{
'source': '...',
'translation': '...',
'labels': [
'main-menu',
'application'
]
}
]Specify Labels as the crowdin upload sources command options:
crowdin upload sources -s "..." -t "..." --label "main-menu" -- label "application"
Excluding target languages for uploaded sources​
By default, the source files are available for translation into all target languages of the project. There is a possibility to specify the languages your file shouldn't be translated into:
'files': [
{
'source': '...',
'translation': '...',
'excluded_target_languages': ['uk', 'fr']
}
]
Or using command options:
crowdin upload sources --excluded-language uk fr
Languages mapping configuration​
Often software projects have custom names for locale directories. Crowdin allows you to map your own languages to be recognizable in your projects.
Let's say your locale directories are named en
, uk
, fr
, de
. All of them can be represented by the %two_letters_code%
placeholder. Still, you have one directory named zh_CH
. You can also override language codes for other placeholders like %android_code%
, %locale%
, etc.
To set up Language Mapping in your configuration file, add the languages_mapping
section to your file set as shown below:
"files": [
{
"source": "/locale/en/**/*.po",
"translation": "/locale/%two_letters_code%/**/%original_file_name%",
"languages_mapping": {
"two_letters_code": {
"uk": "ukr",
"pl": "pol"
}
}
}
]
Note that in the example above, we are configuring mapping for the two_letters_code
placeholder because it is specified in the translation
pattern. If you use a different language placeholder in your translation
pattern, you should also specify this placeholder in the languages_mapping
configuration.
The mapping format is the following: crowdin_language_code
: code_you_use
. Check the full list of Crowdin language codes that can be used for mapping.
Languages Mapping can be also configured in your crowdin.com or Crowdin Enterprise Project Settings > Languages section.
Download Pseudo-localization​
You can configure and download pseudo-localized translation files.
To download an archive with pseudo-localized translation files:
crowdin download --pseudo
Add the pseudo_localization
section to your crowdin.yml
configuration file with the following structure:
pseudo_localization: {
length_correction: 25,
prefix: "",
suffix: "",
character_transformation: "cyrillic"
}
Visit the KB article to read more about Pseudo-Localiation.
Export configuration for specific file formats​
Java Properties​
Escape Quotes
The escape_quotes
option defines whether a single quote should be escaped by another single quote or backslash in exported translations. You can add the escape_quotes
per-file option. Acceptable values are 0
, 1
, 2
, 3
. Default is 3
.
0
- do not escape1
- escape single quote with another single quote2
- escape single quote with a backslash3
- escape single quote with another single quote only in strings containing variables ( {0} )
Escape special characters
Defines whether any special characters (=
, :
, !
and #
) should be escaped by a backslash in exported translations. You can add the escape_special_characters
per-file option. Acceptable values are 0
, 1
. Default is 1
.
0
- do not escape special characters1
- escape special characters by a backslash
Example of the configuration:
"files": [
{
"source": "/en/strings.properties",
"translation": "/%two_letters_code%/%original_file_name%",
"escape_quotes": 1,
"escape_special_characters": 0
}
]
JavaScript​
Export Quotes
The export_quotes
option defines the type of quotes to use in exported translations. You can add the export_quotes
per-file option. Acceptable values are single
, double
. Default is single
.
Example of the configuration:
"files": [
{
"source": "/en/strings.js",
"translation": "/%two_letters_code%/%original_file_name%",
"export_quotes": "double"
}
]
Multilingual Files​
For multilingual file formats (containing multiple languages in one file) you can use the multilingual
option in the configuration. This option allows you to omit the language placeholders in the translation
pattern:
"files": [
{
"source": "Localizable.xcstrings",
"translation": "Localizable.xcstrings",
"multilingual": true
}
]
Configure export options for each file group​
There is a way to specify export options for each file-group in the crowdin.yml
configuration file:
files: [
{
'source': '...',
'translation': '...',
'skip_untranslated_strings': true # Skip untranslated strings
},
{
'source': '...',
'translation': '...',
'skip_untranslated_files': true # Skip untranslated files
},
{
'source': '...',
'translation': '...',
'export_only_approved': true # Export only approved
},
{ # Only for Crowdin Enterprise
'source': '...',
'translation': '...',
'export_string_that_passed_workflow': true # Export only strings that passed workflow
},
]
Ignore hidden files during upload sources​
To ignore hidden files during sources upload, add the following to your configuration file:
settings: {
"ignore_hidden_files": false
}
Default value - true
.