bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: printing plural values outside unsigned long int range


From: Paul Eggert
Subject: Re: printing plural values outside unsigned long int range
Date: Thu, 17 Aug 2006 10:00:22 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> writes:

>> +/* Avoid usages like this one.  */
>> +printf (ngettext ("one file removed", "%d files removed", n), n);
>> address@hidden smallexample
>
> I don't see a reason to avoid such usages. It is perfectly valid, and
> even good style, to omit the number "1" if you can write it out as "one".

That's what I thought too, but Egmont Koblinger wrote in
<http://lists.gnu.org/archive/html/bug-coreutils/2006-08/msg00082.html>
that this confused him.  If the intent is that such usages are OK, how
about if we reduce the confusion by documenting the intent?  We could
add an example like the following:

--- gettext.texi~       2006-06-30 07:25:39.000000000 -0700
+++ gettext.texi        2006-08-17 09:58:04.000000000 -0700
@@ -5198,6 +5198,15 @@ printf (ngettext ("%d file removed", "%d
 Please note that the numeric value @var{n} has to be passed to the
 @code{printf} function as well.  It is not sufficient to pass it only to
 @code{ngettext}.
+
+When translating format strings, @var{msgid1} and @var{msgid2} must
+both be compatible with the arguments given to the formatting
+function, but they need not use the same conversion specifications.
+For example, @var{msgid1} can ignore an argument:
+
address@hidden
+printf (ngettext ("one file removed", "%d files removed", n), n);
address@hidden smallexample
 @end deftypefun
 
 @deftypefun {char *} dngettext (const char address@hidden, const char 
address@hidden, const char address@hidden, unsigned long int @var{n})




reply via email to

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