Home > Tech Note, Translations > create-tx-configuration

create-tx-configuration


Last week while publishing a new guide I ran into a problem creating the Transifex client configuration file (.tx/config).  The configuration file is generally a hateful file that requires a lot of manual manipulation to add in all the POT files for translation.  This file exponentially increases the hatefulness as the number of POT files increase or the complexity of where these POT files increases.  In summary, I hate to create these POT files.  It seems I always end up screwing it up somehow and the Transifex client isn’t real great about telling you why it failed (it just fails in a non-obvious manner).

I started putting together some bash script to write the thing for me until I realized that the script was going to become unwieldy quite quickly.  Luckily I have a boss who doesn’t mind poking me into learning a new trick.  This new trick came in the form of Python.  Realize that the last formal programming class came in the form of a Java class nearly ten years ago.  Since then I try not to touch the stuff.  But now I have a purpose… a need…  a problem in search of a solution… and an excuse to start to learn Python.

So my creation is called create-tx-configuration.  This simple program will read the pot/ directory for .pot files and create the .tx/config file for Transifex to use.  While there was a way to have the Transifex client make the config file the process wasn’t easy nor did it work in all cases.

If you have a need to create Transifex config files please checkout create-tx-configuration and, as always, I appreciate feedback.

Advertisements
  1. shaiton
    2013-03-21 at 05:59 EST

    I usually do that in bash, but use python to use the Transifex API which is quite powerfull.
    I agree, the default file generation is not that powerfull scripting it is best.
    Now that you learned python, you are going to use it every time :)

    You might want to move your comment line 46 just before your loop (l.60).
    Oh, and the best is to use try/except in order to check the error status if you want to provide the right error message (like “could not open the pot dir”).
    Happy tx scripting :)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s