bugGNU gettext - Bugs: bug #23183, msgfmt -c should accept...

 
 

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

bug #23183: msgfmt -c should accept translations that omit any or all arguments

Submitter:  Benjamin Geer <bgeer>
Submitted:  Tue 06 May 2008 04:12:48 PM UTC
   
 
Category:  Plural forms Severity:  3 - Normal
Item Group:  None Status:  Not a Bug
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Tue 06 May 2008 11:20:27 PM UTC, comment #2: 

I have this piece of documentation to the manual, regarding
ngettext:

     If this function is meant to yield a format string that takes two
     or more arguments, you cannot use it like this:

          printf (ngettext ("%d file removed from directory %s",
                            "%d files removed from directory %s",
                            n, dir),
                  n);

     because in many languages the translators want to replace the `%d'
     with an explicit word in the singular case, just like "one" in
     English, and C format strings cannot consume the second argument
     but skip the first argument.  Instead, you have to reorder the
     arguments so that `n' comes last:

          printf (ngettext ("%$2d file removed from directory %$1s",
                            "%$2d files removed from directory %$1s",
                            dir, n),
                  n);

     See *note c-format:: for details about this argument reordering
     syntax.


Bruno Haible <haible>
Group administrator
Tue 06 May 2008 11:00:20 PM UTC, comment #1: 


> If the translation of a plural form includes argument 2 but omits
> argument 1, msgfmt -c rejects it with the following error
> message:
>
> "msgstr[0]' is not a valid C format string, unlike 'msgid'.
> Reason: The string refers to argument number 2 but ignores
> argument number 1."
>
> This is incorrect


The error message is correct. A string like "une piece %$2s"
simply is not a valid C format string. When you pass it to
printf, printf produces an error code.

In C, a format string can choose to ignore the last argument,
however.

> in Arabic, omitting an argument in the translation is often
> the right thing to do. If the value of the argument is 0, 1
> or 2 (as determined by the gettext plural expression), the
> translation should reflect this value by using the appropriate
> the form of the Arabic word for "piece", rather than by
> including the number itself in the translation; therefore the
> translation will not refer to the argument.


Thank you for explaining. What you can do, is to ask the
programmer to swap the assignment of the argument numbers:

English singular:
%2$'d Piece @ %1$s
English plural:
%2$'d Pieces @ %1$s

Then you will be able to omit the reference to argument number
2, and "msgfmt -c" will accept it. (By "the programmer" I mean
the address listed in the Report-Msgid-Bugs-To field of the
PO file header.)

I will add a note about it to the gettext manual. Thank you
very much for bringing up this issue!

Bruno Haible <haible>
Group administrator
Tue 06 May 2008 04:12:48 PM UTC, original submission:  

Given the following message to be translated:

English singular:
%1$'d Piece @ %2$s
English plural:
%1$'d Pieces @ %2$s

If the translation of a plural form includes argument 2 but omits argument 1, msgfmt -c rejects it with the following error message:

"msgstr[0]' is not a valid C format string, unlike 'msgid'. Reason: The string refers to argument number 2 but ignores argument number 1."

This is incorrect, because in Arabic, omitting an argument in the translation is often the right thing to do. If the value of the argument is 0, 1 or 2 (as determined by the gettext plural expression), the translation should reflect this value by using the appropriate the form of the Arabic word for "piece", rather than by including the number itself in the translation; therefore the translation will not refer to the argument. There's an example here on the Arabeyes project Wiki: http://tinyurl.com/4dweuj .

Therefore msgfmt -c should allow the translation to omit any or all arguments, since only the translator can know which ones are needed in a particular language.

Benjamin Geer <bgeer>

 

(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 bgeer (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-26 haible CategoryNone Plural forms
    2008-05-06 haible StatusNone Not a Bug
        Assigned toNone haible
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code