]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
More doc about ngettext.
authorBruno Haible <bruno@clisp.org>
Thu, 17 Aug 2006 18:04:21 +0000 (18:04 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:55 +0000 (12:13 +0200)
gettext-tools/doc/ChangeLog
gettext-tools/doc/gettext.texi

index a92199d98f6bb1aaeebf69551ff2ab6690b8bb47..1d2b118215c37b284550cf16ae4164d070e3075b 100644 (file)
@@ -1,6 +1,13 @@
+2006-08-17  Bruno Haible  <bruno@clisp.org>
+
+       * gettext.texi (Plural Forms): Mention the use of ngettext with a
+       singular format string that doesn't need as many format arguments as
+       the plural string.
+       Suggested by Paul Eggert <eggert@cs.ucla.edu>.
+
 2006-08-16  Bruno Haible  <bruno@clisp.org>
 
-       * gettext.texi (Plural forms): Document how to deal with bignums,
+       * gettext.texi (Plural Forms): Document how to deal with bignums,
        negative numbers and floating-point numbers.
        Suggested by Paul Eggert <eggert@cs.ucla.edu>.
 
index 4d148f2b97053a1c53d020028f0c79b7ca2de010..cf8c06055a614347411eea1f41c6b5c6b7b192ea 100644 (file)
@@ -5199,6 +5199,17 @@ 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}.
 
+In the English singular case, the number -- always 1 -- can be replaced with
+"one":
+
+@smallexample
+printf (ngettext ("One file removed", "%d files removed", n), n);
+@end smallexample
+
+@noindent
+This works because the @samp{printf} function discards excess arguments that
+are not consumed by the format string.
+
 It is also possible to use this function when the strings don't contain a
 cardinal number: