3 # Test of gettext facilities in the PO/POT format.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 # Test with POT format.
10 tmpfiles="$tmpfiles prog-in.pot"
11 cat <<\EOF > prog-in.pot
12 msgid "'Your command, please?', asked the waiter."
16 msgid "a piece of cake"
17 msgid_plural "%d pieces of cake"
22 msgid "%s is replaced by %s."
26 tmpfiles="$tmpfiles prog.tmp prog.pot"
27 : ${XGETTEXT=xgettext}
28 ${XGETTEXT} -o prog.tmp --omit-header --add-location prog-in.pot
29 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
30 LC_ALL=C tr -d '\r' < prog.tmp > prog.pot
31 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
34 ${DIFF} prog-in.pot prog.pot || exit 1
36 # Test with PO format.
38 tmpfiles="$tmpfiles prog-in.po"
39 cat <<\EOF > prog-in.po
42 "Content-Type: text/plain; charset=ISO-8859-1\n"
43 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
45 msgid "'Your command, please?', asked the waiter."
46 msgstr "«Votre commande, s'il vous plait», dit le garçon."
48 # Les gateaux allemands sont les meilleurs du monde.
50 msgid "a piece of cake"
51 msgid_plural "%d pieces of cake"
52 msgstr[0] "un morceau de gateau"
53 msgstr[1] "%d morceaux de gateau"
55 # Reverse the arguments.
57 msgid "%s is replaced by %s."
58 msgstr "%2$s remplace %1$s."
61 tmpfiles="$tmpfiles prog.tmp.po prog.po"
62 : ${XGETTEXT=xgettext}
63 ${XGETTEXT} -o prog.tmp.po --omit-header --add-location prog-in.po
64 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
65 LC_ALL=C tr -d '\r' < prog.tmp.po > prog.po
66 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
69 ${DIFF} prog-in.po prog.po || exit 1