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