summaryrefslogtreecommitdiff
path: root/src/pacman/util.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-07-27 15:50:43 -0500
committerDan McGee <dan@archlinux.org>2010-07-27 15:50:43 -0500
commite7d5803f07c11882685e2a65b5638fd385804d22 (patch)
tree29976b95ccdd0691f9aa2a4bf81bdc041feeffd2 /src/pacman/util.h
parentddc4130c978decc5b2498b24d3b20e0c4efbc3cf (diff)
Use the plural features of gettext
Gettext has this whole 'Plural-Form' thing that until now we haven't taken advantage of. Given that not all languages have the same plural form rules as English, take advantage of it by defining a new _n() macro which will normally define to ngettext(), and adjust a few messages as an example of how to use. There are surely other places where we do singular/plural logic without me having noticed, so further patches are welcome to fix those up too. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/util.h')
-rw-r--r--src/pacman/util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pacman/util.h b/src/pacman/util.h
index bbf43827..d85ba7b6 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -30,8 +30,10 @@
#include <libintl.h> /* here so it doesn't need to be included elsewhere */
/* define _() as shortcut for gettext() */
#define _(str) gettext(str)
+#define _n(str1, str2, ct) ngettext(str1, str2, ct)
#else
#define _(str) str
+#define _n(str1, str2, ct) (ct == 1 ? str1 : str2)
#endif
/* update speed for the fill_progress based functions */