summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/msgunfmt-java-1
blob: 031c9b9c9f38edd64ee0cee2365a5f5cae12e1ac (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
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh

# Test of --java option.

# Note: This test fails when using gcj from GCC 3.1 and GCC 3.2, due to a bug
# (libgcj/6576). It is fixed in GCC 3.3.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

# Test whether we can compile and execute Java programs.
test "${TESTJAVA}" = yes || exit 77

tmpfiles="$tmpfiles fr.po"
cat <<\EOF > fr.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.
#, java-format
msgid "a piece of cake"
msgid_plural "{0,number} pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "{0,number} morceaux de gateau"

# Reverse the arguments.
#, java-format
msgid "{0} is replaced by {1}."
msgstr "{1} remplace {0}."
EOF

tmpfiles="$tmpfiles prog_fr.class"
: ${MSGFMT=msgfmt}
${MSGFMT} -j -d . -r prog -l fr fr.po || exit 1

tmpfiles="$tmpfiles prog.out"
: ${MSGUNFMT=msgunfmt}
CLASSPATH=.${CLASSPATH:+:$CLASSPATH} \
GETTEXTJEXEDIR=../src GETTEXTJAR=../src/gettext.jar \
${MSGUNFMT} --java -d . -r prog -l fr -o prog.out || exit 1

tmpfiles="$tmpfiles prog.sort"
: ${MSGCAT=msgcat}
${MSGCAT} -s prog.out -o prog.sort || exit 1

tmpfiles="$tmpfiles prog.ok"
cat <<\EOF > prog.ok
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\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."

msgid "a piece of cake"
msgid_plural "{0,number} pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "{0,number} morceaux de gateau"

msgid "{0} is replaced by {1}."
msgstr "{1} remplace {0}."
EOF
: ${DIFF=diff}
${DIFF} prog.ok prog.sort || exit 1

rm -fr $tmpfiles

exit 0