(root)/
gettext-0.22.4/
gettext-tools/
tests/
xgettext-c-ctxt-3
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test C support: extraction of contexts specified in GNOME glib syntax.

cat <<\EOF > xg-c-ctxt-3.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

: ${XGETTEXT=xgettext}
${XGETTEXT} --omit-header --no-location \
  --keyword=Q_:1g --keyword=Q_:1g,2g \
  -d xg-c-ctxt-3.tmp xg-c-ctxt-3.c || Exit 1
LC_ALL=C tr -d '\r' < xg-c-ctxt-3.tmp.po > xg-c-ctxt-3.po || Exit 1

cat <<EOF > xg-c-ctxt-3.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-ctxt-3.ok xg-c-ctxt-3.po
result=$?

exit $result