Smarter .po merges

Vincent Ladeuil vila+udd at canonical.com
Fri Nov 25 09:45:56 UTC 2011


Hi guys,

To address http://pad.lv/884270, I've written a plugin implementing a
new merge hook: po_merge (available in a bzr branch at
lp:~vila/bzr/884270-merge-po):

  $ bzr help po_merge
   
  Merge hook for ``.po`` files.
   
  To enable this plugin, add a section to your branch.conf or location.conf
  like::
   
      [/home/user/code/foo]
      po_merge.pot_file = po/xxx.pot
      po_merge.po_files = po/*.po
   
  The ``po_merge.pot_file`` config option takes a list of file paths, separated
  by commas.
   
  The ``po_merge.po_files`` config option takes a list of file globs, separated
  by commas.
   
  The ``po_merge.command`` is the command whose output is used as the result of
  the merge. It defaults to::
   
     msgmerge -N "{other}" "{pot_file}" -C "{this}" -o "{result}"
   
  where:
   
  * ``this`` is the ``.po`` file content before the merge in the current branch,
  * ``other`` is the ``.po`` file content in the branch merged from,
  * ``pot_file`` is the path to the ``.pot`` file corresponding to the ``.po``
    file being merged.
   
  In the simple case where a single ``.pot`` file and a single set of ``.po``
  files exist, each config option can specify a single value.
   
  When several ``(.pot file, .po fileset)`` exist, both lists should be
  synchronized. For example::
   
      [/home/user/code/bzr]
      po_merge.pot_file = po/adduser.pot,doc/po4a/po/adduser.pot
      po_merge.po_files = po/*.po,doc/po4a/po/*.po
   
  ``po/adduser.pot`` will be used for ``po/*.po`` and ``doc/po4a/po/adduser.pot``
  will be used for ``doc/po4a/po/*.po``.

If you encounter conflicts in .po (and .pot) files when dealing with
your packages, this plugin should help.

As of revno 6283, the recommended workflow is:

- merge with the hook disabled => conflicts in .pot and .po files

- resolve conflicts in .pot files

- remerge xxx/*.po with the hook enabled => the .po files are then
  merged with the correct .pot file

To get a better integration and possibly a better (simpler) workflow,
your feedback is needed, read the bug report and comment there or just
reply to this thread.

Thanks in advance,

       Vincent




More information about the ubuntu-distributed-devel mailing list