The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.

Posted by on in Joomla Development
  • Font size: Larger Smaller
  • Hits: 6954
  • Comments

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 crowd sourcing 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, its 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 updation of your transifex config file. That way, everytime 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 - 
    https://compojoom.com/about/blog/entry/transifex-the-tutorial-for-joomla-developers
    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
    https://github.com/techjoomla/Joomla-Extensions/blob/master/scripts/joomlatx.sh
    https://github.com/techjoomla/Joomla-Extensions/blob/master/scripts/project-langs.txt
  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

    myproject/trunk/admin/lang/en-GB
    myproject/trunk/admin/lang/fr-FR
    myproject/trunk/site/lang/en-GB
    myproject/trunk/site/lang/fr-FR
    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 dont 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
    
Rate this blog entry:
0
Trackback URL for this blog entry.

Ashwin is the Lead geek at Techjoomla. The CTO so to say :) Ashwin has been dabbling with Joomla since the Mambo days. He knows his way around PHP Frameworks - Wordpress, Drupal, Magento as well any kind of coding in general just as well as he knows Joomla. The Guy to go to when anyone is faced with a tech challenge, its also his job to make sure the code getting shipped is top notch !


Ashwin loves to travel, eat, cook and of course speak at Joomla Conferences! 

blog comments powered by Disqus