[PATCH] Plurals in messages using ngettext
Tommi Vainikainen <[email protected]> Tue, 12 Apr 2005 13:28:07 +0300
| Newsgroups | gmane.linux.pld.shadow.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, here is a patch to use ngettext instead of string concatenation and static number of cases. Some translations need this to support all plural forms of the language. In other translations, it just preserves context and thus eases translator's job. Patch is against the current version in CVS. -- Tommi Vainikainen
ngettext.patch
(text/x-patch, 686 B)
Index: libmisc/failure.c
===================================================================
RCS file: /cvsroot/shadow/libmisc/failure.c,v
retrieving revision 1.10
diff -u -r1.10 failure.c
--- libmisc/failure.c 31 Mar 2005 05:14:50 -0000 1.10
+++ libmisc/failure.c 12 Apr 2005 09:12:41 -0000
@@ -226,9 +226,10 @@
if (*lasttime == ' ')
lasttime++;
#endif
- printf (_("%d %s since last login. Last was %s on %s.\n"),
+ printf (ngettext("%d failure since last login. Last was %s on %s.\n",
+ "%d failures since last login. Last was %s on %s.\n",
+ fail->fail_cnt),
fail->fail_cnt,
- fail->fail_cnt > 1 ? _("failures") : _("failure"),
lasttime, fail->fail_line);
}