From f33f01f4459910a45ef9476e10b0a1ada77972f1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 17 Aug 2006 18:04:21 +0000 Subject: [PATCH] More doc about ngettext. --- gettext-tools/doc/ChangeLog | 9 ++++++++- gettext-tools/doc/gettext.texi | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index a92199d98..1d2b11821 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -1,6 +1,13 @@ +2006-08-17 Bruno Haible + + * 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 . + 2006-08-16 Bruno Haible - * 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 . diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi index 4d148f2b9..cf8c06055 100644 --- a/gettext-tools/doc/gettext.texi +++ b/gettext-tools/doc/gettext.texi @@ -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: -- 2.47.3