To get Version Control System integration working you have to specify which source files should be translated and how Crowdin should structure the translated files in your repository.
Configure the selected branch to specify the source and translated files path. To open the Branch Configuration dialog click Edit configuration.
Then, you’ll be able to create a configuration or load a configuration file from your repository.
Loading a Configuration
If you already have a configuration file saved in your repository, you can select this file by following these steps:
- Click More.
- Select Load configuration from the drop-down list.
- Enter the name of the configuration file from your repository.
- Click Continue.
Then you can use this configuration as is or you can make some changes, that will be saved to this configuration file.
Creating a Configuration
In the Branch Configuration dialogue, you can create a configuration that will be used for the integration.
For that, name the configuration file and click Continue.
Then, select the source files path, and translated files path using patterns and placeholders listed and explained below.
Once you set up and save the configuration for the selected branch, the configuration file will be saved to the root of the translation branch in your repository.
Represents any character in file or directory name. If you specify a “*.json” it will include all files like “messages.json”, “about_us.json” and anything that ends with “.json”.
** (doubled asterisk)
Matches any string recursively (including sub-directories). Note that you can use ** in both source and translation patterns. When using ** in the translation pattern, it will always contain sub-path from source for a certain file. For example, you can use source: ‘/en/**/*.po’ to upload all *.po files to Crowdin recursively. The translation pattern will be ‘/%two_letters_code%/**/%original_file_name%’.
? (question mark)
Matches any single character.
Matches any single character in a set. Behaves exactly like character sets in Regexp, including set negation ([^a-z]).
Escapes the next metacharacter.
Use placeholders to identify where translated files will be placed and how they will be named:
|%language%||Language name (i.e. Ukrainian)|
|%two_letters_code%||Language code ISO 639-1 (i.e. uk)|
|%three_letters_code%||Language code ISO 639-2/T (i.e. ukr)|
|%locale%||Locale (like uk-UA)|
|%locale_with_underscore%||Locale (i.e. uk_UA)|
|%original_file_name%||Original file name|
|%android_code%||Android Locale identifier used to name "values-" directories|
|%osx_code%||OS X Locale identifier used to name ".lproj" directories|
|%original_path%||Take parent folders names in Crowdin project to build file path in resulted bundle|
|%file_extension%||Original file extension|
|%file_name%||File name without extension|
In case there are files that should not be translated, use the Ignored Pattern option and Crowdin won’t upload specific files for translation.
Often software projects have custom names for locale directories. You are allowed to map your own languages to be recognizable for Crowdin. To add language mapping, fill in the Language Mapping section.
Define the structure of your file in the Scheme field. List the values in the necessary sequence using commas:
- identifier — the column contains a unique identifier of the source string
- source_phrase — this column contains the actual text that should be translated
- source_or_translation — Crowdin should consider the texts in this column as the source strings for translation and replace them with the translated texts when downloading the resulting file
- translation — the resulting translation files are placed in this column
- context — any contextual information that helps to better understand the meaning of the source strings
- max_length — defines the max. length of the translated texts
If a spreadsheet contains the translations for all target languages, you can use the option Multilingual spreadsheet. Also, indicate the sequence of columns with translations in the Scheme filed, for example: identifier,source_phrase,context,uk,ru,fr (Language Codes).
In case, you do not want the text that is included in the first row to be translated, check Import first line as header option.
Configuring XML Files
|Translate Content||Defines whether to translate texts placed inside the tags|
|Translate Attributes||Defines whether to translate tags attributes|
|Content Segmentation||Defines whether to split long texts into smaller text segments. |
Important! This option disables the possibility to upload existing translations for XML files when enabled.
|Translatable Elements||This is an array of strings, where each item is the XPaths to DOM element that should be imported. |
Sample path: /path/to/node or /path/to/attribute[@attr]
The following parameters can’t be configured online:
preserve_hierarchy- saves directory structure in Crowdin
dest- allows you to specify a file name in Crowdin
type- allows you to specify a file type in Crowdin
update_option- keeps translations and keeps/removes approvals from the changed strings during the file update
commit_message- additional commit message, that can include Git tags
export_languages- export translations for the specified languages
After you save the online configuration, a crowdin.yaml file will be created in the configured branch. You can edit this file manually to add the necessary parameters. Read more about the configuration file.
Click Save to preview the created configuration.
Click Add File Filter in case you have various file groups with different configurations.
If there are several branches in the project that share the same configuration, and disparate filters should be applied to them, select Apply filters to all translatable branches.
Click Save to save the created configuration.
After saving, the upload of localizable files to Crowdin will start.