Configuration options for Transifex Client follow standard UNIX practices, also adopted by Version Control System tools. The configuration files the transifex-client is using are simple text files that you can edit by hand. In this section, we will go over the structure of each configuration file, so that if you need to edit a file by hand, you’ll know what to look for.
~/.transifexrc is unique per user and stores the hostname, username and password for every Transifex server that you are using. It is stored in the user’s home directory.
[https://www.transifex.com] hostname = https://www.transifex.com password = p@ssw0rd token = username = user
token variable should be left blank.
Tip: If you change your password on Transifex don’t forget to edit this file with the new password.
You can have a
.transifexrc file in your project directory, too. This could be needed for cases, where you want to override the system-wide credentials. However, you should be careful to not share the file with others, since it contains account details. This could happen, for instance, if you used a VCS (like git) and accidentally added the file to the files it tracks.
transifex-client also uses a per project configuration file to store the project’s details and the file-to-resource mappings. This file is stored in .tx/config in your project’s root directory. It has the following outline:
[main] host = https://www.transifex.com [project_slug.pot_slug] file_filter = languages/pot_slug-<lang>.po source_file = languages/pot_slug.pot source_lang = en_US type = PO
A quick rundown of the sections and options appearing in the config file follows.
In this section we have project-wide options, such as the default transifex host for all projects. These can be overriden by each resource, in case it is needed.
- [main] section
- source_lang: this is the source language of the resource, always en_US.
- source_file: this points to the source file directly.
- file_filter: here we hold the expression used to identify translation files under the specific project. (optional)
- host: in case the project doesn’t use the default Transifex server as specified in the [main] section, it can override it using this option. (optional)
So if you ever need to change the language of a file or correct the file path for a specific translation, you can edit this file directly.
Apart from the above options, the following options are supported, too, either at the main section or the resource section.
- type: The i18n type of the resource. So .po for WordPress projects.
- minimum_perc: The minimum percentage a translation must be completed up to for the client to consider, whether it should pull it or not.
Transifex does not offer a way to revert your config configuration back after some unsuccessful changes. So, make sure you backup the original file before editing by hand.
DEFINING THE MODE OF THE TRANSLATED FILE
Transifex is able to generate different versions of the translation files. For instance, a developer might be interested in files with only reviewed translations or wants a version of the translation file that is suitable for his project. These versions are called modes. Users can specify the mode of the file they want to download with the –mode option of the pull command.
Currently, the available modes are:
- reviewed, for files having only reviewed translations.
- translator, for files that are suitable for off-line translation of the resource.
- developer, for files that are suitable to be used by developers in their source code tree.