bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gettext] feature request: --use-first option for msgmerge


From: Bruno Haible
Subject: Re: [gettext] feature request: --use-first option for msgmerge
Date: Sun, 9 Sep 2007 22:44:59 +0200
User-agent: KMail/1.5.4

Benno Schulenberg wrote:
> > Your fourth command produced an empty file for me in some cases;
> > I think you intended to do something similar to what "msgattrib
> > --no-wrap --no-obsolete" does.
> 
> Ah, indeed.  Maybe `info gettext using` (the node on Using Compendia)
> could mention this command instead of using a 'sed'?

Done.

More generally, the doc in this section has traditionally been written by
the TP coordinator (was Karl Eichwalder), because he has more practical
experience on this topic than me. You are welcome to send updates :-)

> > > Is such a --use-first option to msgmerge feasible?
> >
> > I cannot see in what respect your expected output differs from
> > what "msgmerge --no-wrap  -C $1  $2  $3" already produces.
> 
> This latter command does not overrule messages in $2 that are already
> filled in.  The idea for --use-first is that msgids that are already
> unfuzzily translated in $2 should be replaced by the message in $1 --
> if $1 contains the exact same msgid.  That is for me the idea of a
> Compendium: it should overrule already existing translations.
> ...
> See the attached four files.

Ah, I see: You receive a PO file from someone else, and you don't trust
her translations, and trust your own translations more? OK, this is
achievable by first removing or fuzzying the messages in the PO file.

Step 1: Create a PO file with the original translations removed or weakened.

    msgfilter --keep-header sed -e d < example.nl.po > example1.po
or  msgfilter --keep-header sed -e d < example.nl.po | sed -e '/# /d' > 
example1.po
or  msgfilter --set-fuzzy < example.nl.po > example1.po

(In the first case, we remove the translations but keep the comments.
In the second case, we remove the translations and the translator comments.
In the third case, we degrade the previous translator's work to "fuzzy".)

Step 2: Use the compendium.

    msgmerge -C Compendium example1.po example.pot > example2.po

Step 3: (Not needed is you did --set-fuzzy in step 1.) Fill in those
messages which had a translation in the original PO file but not in the
compendium.

    msgcat --use-first example2.po example.nl.po > example3.po

Then there is also the subsection "Update an Existing Translation File"
which recommends it like this:

    msgcat --use-first Compendium example.nl.po > update.po
    msgmerge update.po example.pot | msgattrib --no-obsolete > example4.po

Except for the header entry, this is also the output you desire.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]