1 #! /bin/sh 2 3 # Test of gettext facilities in the PO/POT format. 4 5 tmpfiles="" 6 trap 'rm -fr $tmpfiles' 1 2 3 15 7 8 # Test with POT format. 9 10 tmpfiles="$tmpfiles prog-in.pot" 11 cat <<\EOF > prog-in.pot 12 msgid "'Your command, please?', asked the waiter." 13 msgstr "" 14 15 #, c-format 16 msgid "a piece of cake" 17 msgid_plural "%d pieces of cake" 18 msgstr[0] "" 19 msgstr[1] "" 20 21 #, c-format 22 msgid "%s is replaced by %s." 23 msgstr "" 24 EOF 25 26 tmpfiles="$tmpfiles prog.pot" 27 : ${XGETTEXT=xgettext} 28 ${XGETTEXT} -o prog.pot --omit-header --add-location prog-in.pot 29 30 : ${DIFF=diff} 31 ${DIFF} prog-in.pot prog.pot || exit 1 32 33 # Test with PO format. 34 35 tmpfiles="$tmpfiles prog-in.po" 36 cat <<\EOF > prog-in.po 37 msgid "" 38 msgstr "" 39 "Content-Type: text/plain; charset=ISO-8859-1\n" 40 "Plural-Forms: nplurals=2; plural=(n > 1);\n" 41 42 msgid "'Your command, please?', asked the waiter." 43 msgstr "Votre commande, s'il vous plait, dit le garon." 44 45 # Les gateaux allemands sont les meilleurs du monde. 46 #, c-format 47 msgid "a piece of cake" 48 msgid_plural "%d pieces of cake" 49 msgstr[0] "un morceau de gateau" 50 msgstr[1] "%d morceaux de gateau" 51 52 # Reverse the arguments. 53 #, c-format 54 msgid "%s is replaced by %s." 55 msgstr "%2$s remplace %1$s." 56 EOF 57 58 tmpfiles="$tmpfiles prog.po" 59 : ${XGETTEXT=xgettext} 60 ${XGETTEXT} -o prog.po --omit-header --add-location prog-in.po 61 62 : ${DIFF=diff} 63 ${DIFF} prog-in.po prog.po || exit 1 64 65 rm -fr $tmpfiles 66 67 exit 0 68