Transifex

  • Documentation
  • CLI Client
  • Init: Initialization

Init: Initialization

The Transifex client handles initialization like most version control systems. The tx init command creates a new setup in your current repository or directory (going forward, we’ll simply use “repo” to refer to both) so that you’ll be able to use the client to manage the translation files.

Where to run tx init and what it does

We recommend running tx init from your repo’s root directory. When you run tx init, two configuration files are created:

  • ~/.transifexrc, which stores your Transifex credentials in your home directory. You shouldn’t share this file since it contains your own credentials.
  • .tx/config, which stores the mappings between your local files and Transifex in a .tx folder in your repo’s root directory. This file should be committed so it can be used by your CI tool or other developers.

First tx init run

When you run the tx init command for the first time, you’ll be guided through an interactive onboarding experience that will help you set up your credentials and file mappings. 

The tx init command will first create a ~/.transifexrc file for storing your credentials. It will then run the tx config command automatically and help you configure the .tx/config file. If you prefer to skip this, use the --skipsetup flag.

$ tx init

Welcome to the Transifex Client! Please follow the instructions to
initialize your project.

Creating .tx folder...
Creating config file...
No credentials file was found at /Users/Sofia/transifexrc. 
Created /Users/Sofia/.transifexrc
Enter your API token: <your_Tranisfex_API_token>
Verifying token...
Updating /Users/Sofia/.transifexrc file...

Getting your Transifex API token

If you don’t have an API token yet, you can generate one at https://www.transifex.com/user/settings/api/.

Automating initialization

If you want to automate initialization, the tx init command offers various options to set the default credentials so you can use the client with non-interactive scripts.

To set your credentials using an API token, use the --token argument:

$ tx init --token=<your_Transifex_API_token>

Alternatively, you can use your Transifex username and password, though this is less recommended:

$ tx init --user=<username> --pass=<password> 

If you're using the client with a CI tool, you can include a --no-interactive flag and skip prompting:

$ tx init --token=<your_Transifex_API_token> --force --no-interactive