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