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