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