All Collections
Using Transifex with GitHub in Your Development Workflow
Using Transifex with GitHub in Your Development Workflow

Learn how to use Transifex with GitHub in your development workflow.

Nina avatar
Written by Nina
Updated over a week ago

GitHub is central to many development teams’ workflows. In this guide, you’ll learn how to synchronize changes between files hosted on GitHub and your localization projects in Transifex. We will show you how to do this with the Transifex GO CLI and also how to use it in conjunction with a Continuous Integration tool for a more automated workflow.

📝Note: Although this article refers to GitHub, a similar workflow can also be used for GitLab.

Syncing a local project to Transifex with the Transifex Go Client

Let’s say you made changes in your code, and there are new strings that need to be translated. You can use the Transifex Go CLI to push these source changes to Transifex.

💡Tip: Whenever you make changes to strings in your codebase, be sure to update your localization files before committing changes. It’s a good practice to enforce a push policy to ensure everyone knows exactly when to sync their changes to Transifex.

Here are the steps to sync a local project to Transifex using the Go CLI:

  1. Use git pull to ensure your local repository is up to date with the remote GitHub repository.

  2. Install the Transifex Go Client if it’s not already installed. You can find detailed instructions on how to do this here. The Transifex Go Client is based on the Git client and uses a similar command structure.

  3. Create a project in Transifex if you don’t have one yet. This project will be used for localizing the resources in your GitHub repository.

  4. From your GitHub repository root, run the tx init command to initialize your local project configuration.

    $ tx init

    Successful creation of '.tx/config' file

    You should now have a .tx folder inside your repository. Inside this folder, a configuration file will contain the information used to identify the project on a Transifex server.

  5. The next thing we need to do is add resources to the configuration file. The simplest way to do this is with tx add command, which will start an interactive session:

    Now, your .tx/config should look like this:

    host =

    source_file = locale/en.php
    file_filter = locale/<lang>.php
    type = PHP
    resource_name = Web Application

    Repeat the same steps for all the files you want to include in your localization process, then add the .tx folder to your Git repository using git add. When other developers pull your changes, they can use the same configuration file to connect their Transifex clients to the Transifex project.

📝Note: For more details about the different ways to set up a project with the Transifex GO CLI, refer to this article.

When you’re ready to push your updated files to Transifex, use the tx push command. The -s flag pushes source files while the -t flag pushes translation files, and -a will push all available locales:

$ tx push -s -t -a

To pull changes into your local project folder, use tx pull:

$ tx pull -a

From here, simply stage, commit, then push the updated localization files to your GitHub repository.

📝Note: For more details about using the Transifex GO CLI and all options on various commands, refer to this article.

Integrating the Client with Travis CI

You can automate the above process and create a continuous localization workflow by incorporating the Transifex GO CLI into your continuous integration chain. Here's how to do it:

  1. Follow the steps above to set up your .tx/config file and commit it to your git branch.

  2. Visit the Travis CI website and create an account if you don't have one yet.

  3. Head to and enable travis-ci for your repository.

  4. On your enabled repository, hit More options > Settings at the top right.

  5. In the Environment Variables section, add two new secret env vars. You can use TRANSIFEX_USER/username with TRANSIFEX_PASSWORD/password, or TRANSIFEX_USER/api with TRANSIFEX_PASSWORD/api key.


  6. Inside your repository, add a .travis.yml file if you don't already have one. We will install Transifex Client and push if the tests pass successfully. Once you have a .travis.yml file, add a section like this inside of it:

    sudo: required
    - pip install virtualenv
    - virtualenv ~/env
    - source ~/env/bin/activate
    - pip install transifex-client
    - sudo echo $'[]\nhostname =\nusername = '"$TRANSIFEX_USER"$'\npassword = '"$TRANSIFEX_PASSWORD"$'\ntoken = '"$TRANSIFEX_API_TOKEN"$'\n' > ~/.transifexrc
    - tx push -s

  7. Commit the travis.yml file to the branch you want to sync translations from. Now every time you commit changes in this branch, your content will be uploaded to Transifex, and your resources will be updated automatically.

Continue Reading

Did this answer your question?