Previous: , Up: Working with PO Files   [Contents][Index]


4.6 Transforming Existing Translation in PO Format

Migrating an existing translation to a PO file format is basically editing the header as described in the previous section, and populating each of the messages by copying the already translated text and markup from the existing translation in HTML format in the relevant message.

Typically, you will visit po/foo.lang.po (in PO mode) and foo.lang.html (in HTML mode) in another buffer. Then you can copy a paragraph or an element from the latter and yank it in the relevant message in the former. Be extra careful, since this is the time to check precisely that the translation corresponds to the original. Further changes will be reflected, but if your “initial” PO file is not a 100% match, that would not necessarily mean that it is an improvement. Since it is very easy to do this kind of check, because the relevant msgid and msgstr appear one above the other in the same buffer (or the similar concept in other PO editors), please do perform this initial sanity check even if you are confident that the translation you have been yanking strings from is a completely up-to-date translation.

There is also a semi-automatic way to produce an initial PO file. You checkout the revision of the English page, foo.html, that corresponds to the latest revision of the translation, foo.lang.html. Then you run gnun-preconvert (see The gnun-preconvert Script):

gnun-preconvert foo.lang.html foo.html

If some passages in foo.lang.html don’t match the structure of foo.html, error messages will be displayed. Check them, adjust the files and try again. When you succeed, the result will be written to foo.lang.po. After that, run gnun-merge-preconverted (see The gnun-merge-preconverted Script):

gnun-merge-preconverted -C compendium.lang.po foo.lang.po foo.pot

If you have no compendium, just omit the “-C compendium.lang.po” part.

You get foo.lang.po where all messages are marked as “fuzzy” (unless you use a compendium); you still should make sure that the translations correspond to the original and remove those “fuzzy” marks. The script adds differences against “previous” msgids to facilitate checking.

There is no need to delete the existing HTML translation, GNUN will automatically overwrite it. The only thing the translator should do is commit the PO file to the repository.

When an essay has been translated by several people through the years, it is important that this information is recorded and reflected in the PO file. In the future, special targets may be added to enable the FSF to check who translated a particular article, and when.

A recommended way to do this is as follows:

# French translation of https://www.gnu.org/philosophy/bsd.html
# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is distributed under the same license as the gnu.org article.
# Cédric Corazza <cedric.corazza@wanadoo.fr>, 2006, 2008.
# Jerôme Dominguez <taz@gnu.org>, 2007.

In this example, it is clear that Cédric made the initial translation, Jerôme made some changes in 2007, and the original translator returned in 2008 and continued maintaining it.


Previous: Useful Hints for Editing PO Files, Up: Working with PO Files   [Contents][Index]