bugGNU gettext - Bugs: bug #62677, Uniqueness of source identifier...

 
 

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

bug #62677: Uniqueness of source identifier not clear

Submitter:  Gábor Hojtsy <gaborhojtsy>
Submitted:  Mon 27 Jun 2022 03:15:48 PM UTC
   
 
Category:  Doc Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Wed 04 Jan 2023 01:34:12 PM UTC, comment #2: 

The fix is contained in gettext 0.21.1.

Bruno Haible <haible>
Group administrator
Sun 03 Jul 2022 09:22:58 AM UTC, comment #1: 

Thanks for the report. It's now fixed through https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=commitdiff;h=805b7597fe5d59c38584fe670d6daa1484ddbfee

> Unfortunately for Drupal this does not match our implemented understanding of the .po format, where we understood that the msgid_plural part of a singular/plural definition is not ignored for uniqueness but rather considered part of the source identifier (its name is msgid_... after all).


I agree that this was an unfortunate misunderstanding.

> So why are gettext tools consider the msgid as a standalone identifier regardless of the msgid_plural alongside it then?


I guess the answer is simplicity: the msgid is the lookup key for the entry. It would have been possible to use the pair (msgid, msgid_plural), but that would have been more complex.

Bruno Haible <haible>
Group administrator
Mon 27 Jun 2022 03:15:48 PM UTC, original submission:  

Drupal is a GPL licensed content management system / web platform. I am one of the core committers.

Drupal added import/export support for .po files in 2004 with Drupal 4.5.0.

Unfortunately our expectation of source uniquness for the past 18 years appears to come back at us. Unfortunately https://www.gnu.org/software/gettext/manual/gettext.html does not define what should be considered a source exactly. There are these two potential ways to define sources, examples copied directly from the docs:


#: lib/error.c:116
msgid "Unknown system error"
msgstr "Error desconegut del sistema"
+verbatim+

and

+verbatim+
#, c-format
msgid "One file removed"
msgid_plural "%d files removed"
msgstr[0] ""
msgstr[1] ""
+verbatim+

While not a recent change, it has come to my attention recently that assuming the above two examples, the following two are invalid (not unique):

+verbatim+
# This will be invalid due to the standalone msgid from above.
msgid "Unknown system error"
msgid_plural "%d unknown system errors"
msgstr[0] ""
msgstr[1] ""
+verbatim+

and

+verbatim+
# This will be invalid due to the plural version from above.
msgid "One file removed"
msgstr ""
+verbatim+

This is due to the identical msgid used. Unfortunately for Drupal this does not match our implemented understanding of the .po format, where we understood that the msgid_plural part of a singular/plural definition is not ignored for uniqueness but rather considered part of the source identifier (its name is msgid_... after all).

The docs on translating plural forms explicitly explains that the msgid in the plural case cannot be interpreted without the msgid_plural and vice versa, plus that they cannot be interpreted without a cardinal number:

> Such an entry denotes a message with plural forms, that is, a message where the text *depends on a cardinal number*. The general form of the message, in English, is the msgid_plural line. The msgid line is the English singular form, that is, the form for when the number is equal to 1.

So as documented where an msgid and msgid_plural combination is defined, the translation cannot be interpreted for a general (independent of cardinal number) case and independent of the msgid_plural.

So why are gettext tools consider the msgid as a standalone identifier regardless of the msgid_plural alongside it then?

Regardless of which is the correct way, I think it would be important to update the documentation. I would be happy to suggest updates to the documentation to make that clear. (After that Drupal may need to go through a considerable transition to update our understanding in multiple major versions).

Gábor Hojtsy <gaborhojtsy>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by gaborhojtsy (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    2022-07-03 haible StatusNone Fixed
        Assigned toNone haible
        Open/ClosedOpen Closed
        SummaryUniquness of source identifier not clear Uniqueness of source identifier not clear

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code