From 4d617a725bb392b23ece06c886b386c3f2accc80 Mon Sep 17 00:00:00 2001 From: Chidambar Zinnoury Date: Sun, 15 Jul 2012 06:45:33 +0000 Subject: [PATCH] e i18n: add plural support thanks to ngettext. SVN revision: 73864 --- configure.ac | 2 +- po/Makevars | 3 ++- src/bin/e_intl.h | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6b9b5da90..89fb058d3 100644 --- a/configure.ac +++ b/configure.ac @@ -256,7 +256,7 @@ AM_GNU_GETTEXT_VERSION([0.17]) ]) m4_ifdef([AM_GNU_GETTEXT], [ -AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT([external], [need-ngettext]) po_makefile_in=po/Makefile.in have_po="yes" ],[ diff --git a/po/Makevars b/po/Makevars index 22837aba4..204167827 100644 --- a/po/Makevars +++ b/po/Makevars @@ -8,7 +8,8 @@ subdir = po top_builddir = .. # These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --from-code=UTF-8 --foreign-user +XGETTEXT_OPTIONS = --keyword=_ --keyword=d_:1 --keyword=P_:1,2 \ + --keyword=dP_:1,2 --keyword=N_ --from-code=UTF-8 --foreign-user # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding diff --git a/src/bin/e_intl.h b/src/bin/e_intl.h index ee67f10a5..8887778d6 100644 --- a/src/bin/e_intl.h +++ b/src/bin/e_intl.h @@ -5,9 +5,13 @@ #ifdef HAVE_GETTEXT #define _(str) gettext(str) #define d_(str, dom) dgettext(PACKAGE dom, str) +#define P_(str, str_p, n) ngettext(str, str_p, n) +#define dP_(str, str_p, n, dom) dngettext(PACKAGE dom, str, str_p, n) #else #define _(str) (str) #define d_(str, dom) (str) +#define P_(str, str_p, n) (str_p) +#define dP_(str, str_p, n, dom) (str_p) #endif /* This macro is used to just mark string for translation, this is useful * for string lists which are not dynamically allocated