1 1.1 christos #! /bin/sh 2 1.1 christos 3 1.1 christos # Test C support: extraction of contexts, disambiguating according to the 4 1.1 christos # argument count. 5 1.1 christos 6 1.1 christos tmpfiles="" 7 1.1 christos trap 'rm -fr $tmpfiles' 1 2 3 15 8 1.1 christos 9 1.1 christos tmpfiles="$tmpfiles xg-c-11.c" 10 1.1 christos cat <<\EOF > xg-c-11.c 11 1.1 christos // (KDE) The 1-argument i18n macro is a simple gettext without context. 12 1.1 christos print (i18n ("help")); 13 1.1 christos // (KDE) The 2-argument i18n macro has the context first. 14 1.1 christos print (i18n ("Help", "about")); 15 1.1 christos // (KDE) The 3-argument i18n macro is an ngettext without context. 16 1.1 christos print (i18n ("error", "errors", 7)); 17 1.1 christos EOF 18 1.1 christos 19 1.1 christos tmpfiles="$tmpfiles xg-c-11.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,2t --keyword=i18n:1,2,3t \ 23 1.1 christos -d xg-c-11 xg-c-11.c 24 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; } 25 1.1 christos 26 1.1 christos tmpfiles="$tmpfiles xg-c-11.ok" 27 1.1 christos cat <<EOF > xg-c-11.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 "error" 36 1.1 christos msgid_plural "errors" 37 1.1 christos msgstr[0] "" 38 1.1 christos msgstr[1] "" 39 1.1 christos EOF 40 1.1 christos 41 1.1 christos : ${DIFF=diff} 42 1.1 christos ${DIFF} xg-c-11.ok xg-c-11.po 43 1.1 christos result=$? 44 1.1 christos 45 1.1 christos rm -fr $tmpfiles 46 1.1 christos 47 1.1 christos exit $result 48