Configuration options for the client follow standard UNIX practices adopted by Version Control System tools. The two configuration files the client uses are simple text files you can edit by hand. In this section, we'll go over the structure of each config file so you'll know what to look for if you need to edit a file by hand. Before you edit anything, we recommend you first set up a project (remote).
~/.transifexrc stores the hostname, username, and password for each Transifex server you use. This config file is unique per user, and it's stored in your home directory.
[https://www.transifex.com] username = user token = password = p@ssw0rd hostname = https://www.transifex.com
token variable should be left blank. And if you change your password on a Transifex server, you should update the password in the file.
You can have a .transifexrc file in your project directory. This could be useful in 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 your account details. For example, you shouldn't track the file with git.
1. Is the username and password specified in your `~/.transifexrc` correct? Edit the file directly to correct, the information in that file is in plain text.
2. Does the user associated with that username have access to the project you're trying to access? Check for view-access by logging in on Transifex and checking whether the project shows up on your dashboard. If you're trying to push files, then the user needs to also be a project maintainer.
The Transifex client uses a per-project config file to store the project's details and the file-to-resource mappings. This file is stored in .tx/config of your project's root directory. It has the following structure:
[main] host = https://www.transifex.com [project_slug.resource_slug] source_file = po/myproj.pot source_lang = en type = PO file_filter = po/<lang>.po trans.fi = translations/fi/LC_MESSAGES/django.po
When you first initialize a project, only the
[main] part of the .tx/config file will be completed.
The .tx/config file contains project-wide options, such as the default Transifex host for all projects, which can be overridden on a resource level. Here's what each of the sections and options in the mean:
- [main]: this section contains information shared across projects and resources.
- [host]: should be the same host as in .transifexrc file.
- [project_slug.resource_slug]: your project and resource 'slugs', separated by a dot. These are the strings found on your project's URL and together they uniquely identify your translatable resource.
- source_file: this points to the source file directly.
- source_lang: this is the source language of the resource.
- type: The i18n type of the resource. Transifex natively supports a number of user-formats file formats, also referred to as resource types. While Transifex does its best to guess your file type based on the file extension and contents, it ultimately requires you to define the resource type. or a list of the available resource types, please refer to Supported File Formats.
- file_filter: here we hold the expression used to identify translation files under the specific project. (optional)
- trans.<lang>: this is used for translation files that don't follow a common naming schema and the file expression cannot be used to track them. (optional)
Common name schema:translations/<project_slug.resource_slug>/<lang>.<type>
- minimum_perc: The minimum percentage a translation must be completed up to for the client to consider, whether it should pull it or not. (optional)
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. However, Transifex doesn't offer a way to revert your configuration changes. So be sure to back up the original file before making edits.
By default, Transifex uses ISO 639-1 language codes. If you have your own language mappings and use language codes other than the ISO standard ones, the Transifex Client offers a quick and easy way to set up custom one-to-one language mappings. You'll just need to add a lang_map section to the .tx/config file and structure it as follows:
lang_map = REMOTE_CODE:LOCAL_CODE, REMOTE_CODE:LOCAL_CODE
lang_map = el:el_GR, sr@latin:sr_latin
You can even combine global mappings (which apply to all resources and are placed in the [main] section of your configuration file) with resource specific language mappings (which extend the global mapping with the local ones). For example:
[main] host = https://www.transifex.com lang_map = el: el-GR, de: de-DE [foo.bar] file_filter = translations/foo.bar/<lang>.po source_lang = en lang_map = fr: fr-FR
With the above configuration, you'll be able to pull the Greek translations with the command:
tx pull -l el
The language mapping only supports one-to-one relations. It will not work with many-to-one setups.