bugGNU gettext - Bugs: bug #25016, Allow empty strings for msgid,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #25016: Allow empty strings for msgid, msgstr when using msgctxt

Submitted by:  None
Submitted on:  Fri 05 Dec 2008 05:42:45 AM UTC  
 
Category: Translator toolsSeverity: 3 - Normal
Item Group: NoneStatus: Not a Bug
Privacy: PublicAssigned to: Bruno Haible <haible>
Open/Closed: Closed

Mon 08 Dec 2008 03:00:19 AM UTC, comment #2:

>> msgstr "": untranslated unless msgid "" and msgctxt is set
>
> There needs to be a distinction between translated and
> untranslated messages. For years, in PO files, this distinction
> is done by testing whether msgstr is empty or not. Also, when
> msgmerge adds a new message to a PO file, the translated must
> have a way to know that he needs to look at this message. One
> could, in theory, use the fuzzy flag to denote this. But the
> many PO file editors around would need to change for this; I
> don't think it's worth the effort.


A number of those editors haven't been updated to support msgctxt anyway. But for those that have, the rule I suggested would only affect a very small percentage of messages, even if the editor didn't support the fuzzy flag suggestion. But having the command-line tools know the difference would still be helpful.

> The translator can, for
> example, use a string with only a zero-width no-break space
> (or some other Unicode control character) instead of an empty
> string.


That's true, but probably not in all cases (eg lists of optional classes to be loaded). However, where it's appropriate, it could be used as a workaround with editors like those above.

The problem is, I'm dealing with some pretty general problems - Java .properties files contain a hodge-podge of translatable text, localisable configuration and unlocalisable configuration. It's unfortunate that Sun conflated the problems of configuration and localisation in Java!

I'm trying to map these things into po/pot files because (a) open source translators are often used to dealing with po/pot, not .properties and (b) a number of tools exist for processing and analysing po files (particularly the gettext-tools).

I can see I haven't made the case that empty msgids make sense, and without empty msgids, empty msgstrs don't make sense either.

> I think empty msgids are better avoided. After the step of
> preparing strings
>
> <http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#Preparing-Strings>
> I can hardly see how empty msgids can appear.


In a normal gettext program, I would agree. But anything that tries to map .properties files into pot files will eventually run into an empty string, because .properties are such a mixture. To give some examples, most of the empty strings I've found in JBoss Tools have been gui titles and descriptions (presumably to be filled in later), but there are also empty lists of classnames and empty image names. It's possible that these lists/image names could be non-empty in some locales. As for the gui titles and descriptions, yes, they probably should be filled in, but it would be nice if the gettext-tools worked on translations which are being cleaned up.

Java codebases which have been internationalised without gettext tend to use artificial property keys with the English text as the property value. They don't usually use the English text as the key, the way gettext encourages. The prop->po mapping used by msgcat --properties-input puts the English string into msgstr, but that doesn't work if you want to generate self-contained pot files, since the pot won't have the msgstr.

Now that gettext supports msgctxt, I think the mapping used in Ant-Gettext (or prop2po --duplicates=msgctxt) makes better sense for such codebases, since it preserves both the property key and the English text from the .properties file, in the pot. (Perhaps I should raise a bug against msgcat for a new option?)

Even though the .properties format is quite ugly, I don't have much chance of convincing Java developers to accept po/pot unless it supports the way they already work. And I would like to standardise on po/pot if I can, if only to avoid proliferation of translation formats. With this tweak, I think the po format would work quite well in this situation.

Would you accept a patch for this if I developed one?

Sean Flanigan <seanf>
Sun 07 Dec 2008 07:46:13 PM UTC, comment #1:

> msgstr "": untranslated unless msgid "" and msgctxt is set


There needs to be a distinction between translated and
untranslated messages. For years, in PO files, this distinction
is done by testing whether msgstr is empty or not. Also, when
msgmerge adds a new message to a PO file, the translated must
have a way to know that he needs to look at this message. One
could, in theory, use the fuzzy flag to denote this. But the
many PO file editors around would need to change for this; I
don't think it's worth the effort. The translator can, for
example, use a string with only a zero-width no-break space
(or some other Unicode control character) instead of an empty
string.

> Some of the English values in the .properties files are empty
> strings, which become empty msgids, and are often translated
> with empty msgstrs.


I think empty msgids are better avoided. After the step of
preparing strings
<http://www.gnu.org/software/gettext/manual/html_node/Preparing-Strings.html#Preparing-Strings>
I can hardly see how empty msgids can appear.

Bruno Haible <haible>
Project AdministratorIn charge of this item.
Fri 05 Dec 2008 05:42:45 AM UTC, original submission:

The problem I have encountered is with msgcmp, but I think this is a general issue.

The attached po/pot files have messages with msgid "" and msgstr "", but non-null msgctxt. Running "msgcmp en_AU.po messages.pot" leads to these errors:

en_AU.po:16: this message is untranslated
en_AU.po:16: warning: this message is not used
msgcmp: found 1 fatal error

The error "this message is untranslated" is because the msgstr is "", which normally indicates an untranslated string. However, since the msgid is also "" (bear with me here!), an empty translation is probably okay, so I think this should be a warning at most.

The warning "this message is not used" seems to indicate that the message (msgctxt "message1" msgid "") was not found in the pot file. No doubt this is because msgid "" in the pot file is assumed to be the header. But the message with msgid "" has a msgctxt, so it should not be treated as the header but as an ordinary message.

If you are wondering why on earth I would want empty msgid/msgstr, read on...

I have pot files which were converted from Java .properties files using Tennera Ant-Gettext's prop2pot. (This conversion is different from "msgcat --properties-input", but similar to "prop2po --duplicates=msgctxt" in the Translate Toolkit. The property name becomes the msgctxt, and the property value (assumed to be English text) becomes the msgid.)

Some of the English values in the .properties files are empty strings, which become empty msgids, and are often translated with empty msgstrs. I know empty msgid/msgstr have special meanings in gettext, but I think it would make sense to treat them differently in cases where msgctxt is provided:

msgid "": gettext header unless msgctxt is set
msgstr "": untranslated unless msgid "" and msgctxt is set

Anonymous

 

Attached Files
file #16984:  messages.pot added by None (604B - application/vnd.ms-powerpoint - Example po/pot with empty msgid/msgstr but non-empty msgctxt)
file #16985:  en_AU.po added by None (390B - application/x-crossover-po - Example po/pot with empty msgid/msgstr but non-empty msgctxt)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by seanf (Posted a comment)
  • -unavailable- added by haible (Posted a comment)
  • -unavailable- added by seanf ((Original submitter))
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 12:08:44 AM UTChaibleCategoryNone=>Translator tools
    Sun 07 Dec 2008 07:46:13 PM UTChaibleStatusNone=>Not a Bug
      Assigned toNone=>haible
      Open/ClosedOpen=>Closed
    Fri 05 Dec 2008 05:49:20 AM UTCseanfCarbon-Copy-=>Added seanf
    Fri 05 Dec 2008 05:42:45 AM UTCNoneAttached File-=>Added messages.pot, #16984
      Attached File-=>Added en_AU.po, #16985

    Back to the top


    Powered by Savane 3.1-cleanup1