]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test for extraction of context in GNOME glib syntax.
authorBruno Haible <bruno@clisp.org>
Thu, 16 Mar 2006 13:09:16 +0000 (13:09 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:03 +0000 (12:13 +0200)
gettext-tools/tests/xgettext-c-15 [new file with mode: 0755]

diff --git a/gettext-tools/tests/xgettext-c-15 b/gettext-tools/tests/xgettext-c-15
new file mode 100755 (executable)
index 0000000..46db63a
--- /dev/null
@@ -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 <<EOF > 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