• 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 host configuration in your home directory, or your Transifex credentials if you don’t use an environment variable for your Transifex token. You shouldn’t share this file if it contains your 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.

Before running tx init

If you don’t want your token credential to be stored in the .transifexrc file, you should create an environment variable (TX_TOKEN) for it. We strongly doing this as it’s a more secure way to expose your token in the client.

$ export TX_TOKEN=<your_Transifex_API_token>

If you are using sudo to run your tx commands, you will need to explicitly set the TX_TOKEN variable in your calls.

$ sudo TX_TOKEN=$TX_TOKEN tx init

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 host info, or if you’re not using environment tokens, it’ll store 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

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, either use the TX_TOKEN environment variable (preferred):

$ export TX_TOKEN=<your_Transifex_API_token>

Or 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