bug-gettext
[Top][All Lists]
Advanced

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

[bug-gettext] Documentation error in an example of ngettext?


From: Reinhard Schaffner
Subject: [bug-gettext] Documentation error in an example of ngettext?
Date: Wed, 26 Dec 2012 23:15:54 +0000
User-agent: Microsoft-MacOutlook/14.0.0.100825

Aloha,

how are you?

From: http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms

Examples for "ngettext", currently says:

<quote>
If this function is meant to yield a format string that takes two or more arguments, you can not 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);
</quote>

instead, shouldn't it say (changes highlighted):


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

and:

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


?

If so, just a minor detail, as the essence of the example is the correct reordering of params.
If not so, sorry for the trouble, my bad!

A thousand thanks, r.

reply via email to

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