1#! /bin/sh 2. "${srcdir=.}/init.sh"; path_prepend_ . ../src 3 4# Test C support: extraction of contexts. 5 6cat <<\EOF > xg-c-ctxt-1.c 7// (KDE) The 1-argument i18n macro is a simple gettext without context. 8print (i18n ("help")); 9// (KDE) The 2-argument i18n macro has the context first. 10print (i18n ("Help", "about")); 11// (Qt) The 2-argument tr function has the context last. 12print (tr ("file")); 13print (tr ("open", "File")); 14EOF 15 16: ${XGETTEXT=xgettext} 17${XGETTEXT} --omit-header --no-location \ 18 --keyword=i18n:1 --keyword=i18n:1c,2 --keyword=tr:1 --keyword=tr:1,2c \ 19 -d xg-c-ctxt-1.tmp xg-c-ctxt-1.c || Exit 1 20LC_ALL=C tr -d '\r' < xg-c-ctxt-1.tmp.po > xg-c-ctxt-1.po || Exit 1 21 22cat <<EOF > xg-c-ctxt-1.ok 23msgid "help" 24msgstr "" 25 26msgctxt "Help" 27msgid "about" 28msgstr "" 29 30msgid "file" 31msgstr "" 32 33msgctxt "File" 34msgid "open" 35msgstr "" 36EOF 37 38: ${DIFF=diff} 39${DIFF} xg-c-ctxt-1.ok xg-c-ctxt-1.po 40result=$? 41 42exit $result 43