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