[Top][All Lists]

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

Re: [bug-gettext] msgcat error when merging fuzy entry with empty transl

From: CircleCode
Subject: Re: [bug-gettext] msgcat error when merging fuzy entry with empty translation
Date: Thu, 15 Jun 2017 08:35:24 +0200

On Thu, Jun 15, 2017 at 1:16 AM, Bruno Haible <address@hidden> wrote:
> Hi,
>> given these 2 files:
>> ----8<--- test1.pot ----------
>> #, fuzzy
>> msgid "foo"
>> msgstr "foo"
>> ------------------------->8---
>> ----8<--- test2.pot ----------
>> msgid "foo"
>> msgstr ""
>> ------------------------->8---
>> msgcat does not ignore empty translation from test2:
>> $ msgcat test1.pot test2.pot
>> #, fuzzy
>> msgid "foo"
>> msgstr ""
>> "#-#-#-#-#  test1.pot  #-#-#-#-#\n"
>> "foo\n"
>> "#-#-#-#-#  test2.pot  #-#-#-#-#\n"
>> while it correctly ignore it if we remove the fuzzy comment from test1:
>> $ sed -i 's/#, fuzzy//' test1.pot && msgcat test1.pot test2.pot
>> msgid "foo"
>> msgstr "foo"
>> is this a feature or a bug?
> I see it as a feature. msgcat has a multitude of use-cases. For the use-case 
> of
> concatenating POT files (which have 'msgstr ""' for *all* messages), it would
> be useless if msgcat would throw away messages with 'msgstr ""'.

I get this very specific use case - and i agree with you -
but it applies if all translations for the same msgid are empty.

In my case, one translation is not empty and the other one is.
What I don't understand is the difference between my 2 tests:
- if neither of the translations are fuzzy, and only one is not empty,
  msgcat keeps only the not empty one
  => in this case, it _ignores the empty one_
- if the not empty translation is fuzzy, msgcat merges the not empty translation
  with the empty translation
  => in this case, it _does not ignore the empty one_

> You can achieve what you want by preprocessing test2.pot (and maybe test1.pot
> as well?) with "msgattrib --translated".

what I would like to achieve is a resulting file containing
all msgid from test1.po and test2.po, with following translations
- empty translation if both file1 and file2 have empty translation
- translation from file1 if file 2 has empty translation
- translation from file1 if file 2 has no corresponding msgid
- translation from file2 if file 1 has empty translation
- translation from file2 if file 1 has no corresponding msgid
- merged translations if both file1 and file2 have non empty translation
additionnaly, it should also respect these rules:
- comments from both files are merged (wether this string is
translated or not in both files)
- the translation is marked as fuzzy only if
  - several translations were merged
  - both strings were fuzzy

It seems to me that it cannot be easily achieved with only msgattrib and msgcat.

> With msgattrib and msgcat together, you have great flexibility, depending on
> what you want to achieve.
> Bruno


reply via email to

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