From: Bruno Haible Date: Thu, 16 Mar 2006 13:09:16 +0000 (+0000) Subject: Test for extraction of context in GNOME glib syntax. X-Git-Tag: v0.15~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=765fd7ab5f5b28ba0db87f3325c7042d194a9530;p=thirdparty%2Fgettext.git Test for extraction of context in GNOME glib syntax. --- diff --git a/gettext-tools/tests/xgettext-c-15 b/gettext-tools/tests/xgettext-c-15 new file mode 100755 index 000000000..46db63a9a --- /dev/null +++ b/gettext-tools/tests/xgettext-c-15 @@ -0,0 +1,42 @@ +#! /bin/sh + +# Test C support: extraction of contexts specified in GNOME glib syntax. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-c-15.c" +cat <<\EOF > xg-c-15.c +/* (glib) The 1-argument Q_ macro is a gettext with context. */ +print (Q_ ("Printer|Open")); +/* (hypothetical) The 2-argument Q_ macro is an ngettext with contexts. */ +print (Q_ ("Menu|Recent File", "Menu|Recent Files")); +EOF + +tmpfiles="$tmpfiles xg-c-15.po" +: ${XGETTEXT=xgettext} +${XGETTEXT} --omit-header --no-location \ + --keyword=Q_:1g --keyword=Q_:1g,2g \ + -d xg-c-15 xg-c-15.c +test $? = 0 || { rm -fr $tmpfiles; exit 1; } + +tmpfiles="$tmpfiles xg-c-15.ok" +cat < xg-c-15.ok +msgctxt "Printer" +msgid "Open" +msgstr "" + +msgctxt "Menu" +msgid "Recent File" +msgid_plural "Recent Files" +msgstr[0] "" +msgstr[1] "" +EOF + +: ${DIFF=diff} +${DIFF} xg-c-15.ok xg-c-15.po +result=$? + +rm -fr $tmpfiles + +exit $result