gettext: Translations under Version Control
13.6.3 Put PO Files under Version Control
-----------------------------------------
Since translations are valuable assets as well as the source code, it
would make sense to put them under version control. The GNU gettext
infrastructure supports two ways to deal with translations in the
context of a version controlled repository.
1. Both POT file and PO files are committed into the repository.
2. Only PO files are committed into the repository.
If a POT file is absent when building, it will be generated by
scanning the source files with ‘xgettext’, and then the PO files are
regenerated as a dependency. On the other hand, some maintainers want
to keep the POT file unchanged during the development phase. So, even
if a POT file is present and older than the source code, it won’t be
updated automatically. You can manually update it with ‘make
$(DOMAIN).pot-update’, and commit it at certain point.
Special advices for particular version control systems:
• Recent version control systems, Git for instance, ignore file’s
timestamp. In that case, PO files can be accidentally updated even
if a POT file is not updated. To prevent this, you can set
‘PO_DEPENDS_ON_POT’ variable to ‘no’ in the ‘Makevars’ file and do
‘make update-po’ manually.
• Location comments such as ‘#: lib/error.c:116’ are sometimes
annoying, since these comments are volatile and may introduce
unwanted change to the working copy when building. To mitigate
this, you can decide to omit those comments from the PO files in
the repository.
This is possible with the ‘--no-location’ option of the ‘msgmerge’
command (1). The drawback is that, if the location information is
needed, translators have to recover the location comments by
running ‘msgmerge’ again.
---------- Footnotes ----------
(1) you can also use it through the ‘MSGMERGE_OPTIONS’ option from
‘Makevars’