gettext: Translations under Version Control

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