summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/lang-po
blob: c04a3437b4b78992d9e1e1cb188e515d23434e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test of gettext facilities in the PO/POT format.

# Test with POT format.

cat <<\EOF > prog-in.pot
msgid "'Your command, please?', asked the waiter."
msgstr ""

#, c-format
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] ""
msgstr[1] ""

#, c-format
msgid "%s is replaced by %s."
msgstr ""
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} -o prog.tmp --omit-header --add-location prog-in.pot || exit 1
LC_ALL=C tr -d '\r' < prog.tmp > prog.pot || exit 1

: ${DIFF=diff}
${DIFF} prog-in.pot prog.pot || exit 1

# Test with PO format.

cat <<\EOF > prog-in.po
msgid ""
msgstr ""
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

msgid "'Your command, please?', asked the waiter."
msgstr "«Votre commande, s'il vous plait», dit le garçon."

# Les gateaux allemands sont les meilleurs du monde.
#, c-format
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "%d morceaux de gateau"

# Reverse the arguments.
#, c-format
msgid "%s is replaced by %s."
msgstr "%2$s remplace %1$s."
EOF

: ${XGETTEXT=xgettext}
${XGETTEXT} -o prog.tmp.po --omit-header --add-location prog-in.po || exit 1
LC_ALL=C tr -d '\r' < prog.tmp.po > prog.po || exit 1

: ${DIFF=diff}
${DIFF} prog-in.po prog.po || exit 1

exit 0