2 minutes reading time (463 words)

Automating multiple extension translation management using the Transifex client and a shell script


We've been using Transifex for more than a year now, and quite happy with the way crowdsourcing can help enrich the reach of your extensions. However, updating all the resources for all the extensions was a painful task and something everyone wanted to avoid. The tx-client eases some pain by allowing easy pushes & pulls of source files & translations. However, the tx-client relies on a 'config' file to be updated with all the resource slugs. With so many extensions and also with so many plugin language files getting added regularly, it's a tough task to keep on updating the config file.

At Techjoomla we had almost 10 major extensions using Transifex, each with 5-10 resources. To speed up things, here's a shell script that I wrote up. The script automates updating of your Transifex config file. That way, every time you need to add more resources, just pull them from your source control and run the joomlatx.sh script and your config will be updated with all the resources.

Here's a step by step tutorial on how to set up and use the script

  1. Set up the Transifex client and configure your username and password. Here are a few guides on how to do that - 
    Also, ensure that the language map is correctly set up, this is an important step.
  2. Assuming you have all your repositories in /home/ashwin/SVN initialise the tx client in that folder
    $ cd /home/ashwin/SVN
    $ tx init
  3. Copy the joomlatx.sh and the project-langs.txt from github into the SVN folder
  4. The project-langs.txt needs to be updated with the correct locations of your files for each Transifex project. The word in the square brackets is 'slug' of your project on Transifex. This is the projectname part of the URL when you visit your project page on transifex.net. The lines following are the locations where project language files are present. 

    Assuming English (en-GB) is your base language your repository should be set up as

    In this case, you should only put the path till the /lang folder. The script will automatically pick up the default language files based on the setting in joomlatx.sh

  5. Once this is set up simply run the script
    $ ./joomlatx.sh
  6. Note: If you have already set up resources in Transifex, then you will need to update the resource slugs in Transifex according to the relevant slug names that have been created in the config file by the script. If you don't do this, you will end up with duplicate language files on Transifex.

  7. Running the script will update your config file and map the language files to Transifex resources.
  8. Now you can simply push and pull source and translations. If there are new translations, the client automatically creates the folders and copies the files.
    $ tx push -s
    $ tx pull
Two new free plugins for JMailAlerts Released!
People Suggest 1.4 is here with Joomla 3.X support...

Related Posts