Integration with other translation tools

Integration with other translation tools, like desktop PO file editors (Virtaal, Lokalize, etc.), web based translation tools (Pootle, Transifex, etc.), can be done by exporting and importing translation files. It can be done on the web interface, from the dashboard of a project. But it can be done from the terminal as well (if you have access on the server).

This is how the commands look like:

cd /var/www/data/
drush btr-project-export origin project lng /directory/to/place/exported/files/
drush btr-vote-import --user="user name" lng /path/of/po/files/to/be/imported/

While exporting, it will by default export the most voted translation of a string (or whatever happens to be at the top of the list of translations). There are ways to modify this befaviour. For example you can export the original translations that were imported at the begining, or you can give priority to the the translations preferred (voted) by one or more users. In this case the preferred translations will be exported even if they don't have the maximum number of votes.

The import command requires a username, as well as a language. All the translations that are in the imported PO files will be recorded as supported by the given username. If a translation does not exist, it will be recorded as suggested by the user. If it exists, it will be marked as supported (voted) by the user. So, importing translation PO files is like a bulk translation and voting operation.

Exporting and importing PO files can be useful if the user prefers to work with offline desktop tools for translating. He can first export the PO files of a project, work with them on desktop, and then upload and import them back to B-Translator.

It also helps for synchronizing with other translation systems. Let's say that we want to synchronize with Pootle; the process of synchronization would usually follow these steps:

  1. Export (download) PO files from Pootle.
  2. Import PO files to B-Translator. During this import they will be merged with the existing translations, since B-Translator supports more than one translation for string.
  3. Export PO files from B-Translator. This will export the most voted translations or those that are preferred by some users.
  4. Import (upload) PO files back to Pootle. This import will override the previous translations.

Here is a script that automates this synchronization process for a subproject of LibreOffice: modules/custom/btrCore/data/sync/sq-libo_ui.sh
Similar synchronization scripts can be built for other projects as well (KDE, GNOME, etc.) but I havn't tried it yet.