Automating script frontend translation.

Common format used by many frameworks (I’m talking about PHP frameworks, as I mostly use PHP) is XLIFF. Actually it’s just XML. As a result, modifying these translation files aren’t very handy. You should care about tags, ids etc.

There is other, more older format for managing translations – po. I find it easier to maintain. Moreover, there are tools which can help you create/update these translation files. I steal this info from symfony website.

First tool – xgettext (Debian package gettext). It allows you to create .po file from your source file. It supports several programming languages. To create new file:

xgettext --language=PHP --output=output.file.po --extract-all --no-location index.php

To update existing .po file:

xgettext --language=PHP --output=existing.file.po --extract-all --no-location --join-existing index.php

New terms will be added to the end of file.

Second tool – po2xliff (Debian package translate-toolkit). Yes, it converts .po to .xliff :)

Friday, November 16th, 2007