summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/msgfmt-5
blob: f4fb368454160b7e1234298c5a3d54dfcaeafd54 (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
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# Test multi-domain handling.

cat <<\EOF > foo.po
domain "foo-de"
msgid ""
msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"

# Das ist ein Kommentar.
msgid "hello"
msgstr "Hallo"

# Noch einer.
msgid "bye"
msgstr "Tschüß"

domain "foo-fr"
msgid ""
msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"

# Ceci est un commentaire.
msgid "hello"
msgstr "Salut"

# Encore un.
msgid "bye"
msgstr "A bientôt"
EOF

: ${MSGFMT=msgfmt}
${MSGFMT} foo.po || exit 1

: ${MSGUNFMT=msgunfmt}
${MSGUNFMT} -o foo-de.tmp foo-de.mo || exit 1
LC_ALL=C tr -d '\r' < foo-de.tmp > foo-de.out || exit 1
${MSGUNFMT} -o foo-fr.tmp foo-fr.mo || exit 1
LC_ALL=C tr -d '\r' < foo-fr.tmp > foo-fr.out || exit 1

cat <<\EOF > foo-de.ok
msgid ""
msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"

msgid "bye"
msgstr "Tschüß"

msgid "hello"
msgstr "Hallo"
EOF

cat <<\EOF > foo-fr.ok
msgid ""
msgstr "Content-Type: text/plain; charset=ISO-8859-1\n"

msgid "bye"
msgstr "A bientôt"

msgid "hello"
msgstr "Salut"
EOF

: ${DIFF=diff}
${DIFF} foo-de.ok foo-de.out && ${DIFF} foo-fr.ok foo-fr.out
result=$?

exit $result