Merge PO files

The command line tool msgmerge is used to merge translated strings from two PO files into one. It is really easy to use, here is a generic example:

msgmerge your-po-file reference-po-file > output.po

The result in output.po contains translations from your-po-file merged with the reference-po-file.

It is possible to merge strings by bypassing the redirection with the following options:

msgmerge --backup=none -U your-po-file reference-po-or-pot-file

This has the same effect, except the output is directly written inside your-po-file.

You can use a POT file as reference PO file in order to sync your current translations with new and suppressed messages.

Merge between stable and development branch

You can use this tool to merge strings from a development branch into the stable branch or vice versa. This is highly recommended to avoid unnecessary work.

A specific example is probably handy. Suppose you are working on the project Thunar, you can download PO files on Transifex for both the stable and development branch.

Let's say Thunar is fully translated in the stable “xfce-4.8” branch and needs to be merged with an incomplete Dutch translation file in the development branch “master”.

Once downloaded, let's say both files are available in the directory “Downloads” of your home directory, which is the usual location of downloaded files.

Copy/paste the following command in your terminal:

cd Downloads

Now copy/paste the following command in your terminal:

msgmerge Thunar-xfce-4-8.nl.po Thunar-master.nl.po > NEW-Thunar-master.nl.po

Then delete both Thunar-xfce-4-8.nl.po (you don't need it anymore) and Thunar-master.nl.po (you don't want a name conflict in the next step).

Upload NEW-Thunar-master.nl.po in Transifex.