This is what the polib version does already. If a translation is marked
fuzzy then it is not used, so if the other file contains a non-fuzzy
translation we do not throw away useful information if we overtake it.
If the -o option is given, we may overwrite existing translations with
translations from the other .po file. In this case, we have to delete or set
the fuzzy flag accoring to the updated translation.
he.po in branch contains a number of translations where the translation is
identical with the original text (e.g. for encoding names) which look suspicios
to me. Therefore I did not want to merge these and leave the decision to the
translator. No information is lost, since these "translations" can easily be
recreated from the original texts by copy-paste.
This is useful if you know that the translation of a particular language has
not been updated at all in master, but the stable version has been worked on.
Some characters (like ") are escaped in .po files. These are handled correctly
by polib, but the self written parser did not yet take them into account.
We need to remove the #~ prefix of each line, since it is re-added after
wrapping, and because otherwise the comparison with entries from polib
does not work.
Now it is possible to specify the target directory, and the command line syntax
follows the standard rules: It uses options for optional arguments, and one
positional argument for the single required argument.
Surprisingly I could not find a tool that merges updated translations into a
.po file in a way that
a) merges only missing translations (does not overwrite existing ones)
b) produces a minimal diff so that there is a chance to manually check the result
Therefore I wrote my own. You can use it for a single language
python development/tools/mergepo.py ../lyx-2.1/po fr
or for all languages:
python development/tools/mergepo.py ../lyx-2.1/po
The python code is not the most elegant one, but it works. What is missing is
a command line switch to merge changed translations as well. This is useful
for languages that have not yet received any translation update in the
development branch, only in the stable branch: In this case we know that
translations that are not identical in both branches should be overtaken from
the stabkle one.