blob: 39c4f22d4d261d808bef2b97708a157e5ca75964 (
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
75
76
77
78
79
80
81
82
83
84
|
#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles cake.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o cake.pot --omit-header ${top_srcdir}/tests/plural-1-prg.c
tmpfiles="$tmpfiles cake.ok"
cat <<EOF > cake.ok
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] ""
msgstr[1] ""
EOF
: ${DIFF=diff}
${DIFF} cake.ok cake.pot || exit 1
tmpfiles="$tmpfiles fr.po"
cat <<EOF > fr.po
# Les gateaux allemands sont les meilleurs du monde.
msgid "a piece of cake"
msgid_plural "%d pieces of cake"
msgstr[0] "un morceau de gateau"
msgstr[1] "%d morceaux de gateau"
EOF
tmpfiles="$tmpfiles fr.po.new"
: ${MSGMERGE=msgmerge}
${MSGMERGE} -q -o fr.po.new fr.po cake.pot
: ${DIFF=diff}
${DIFF} fr.po fr.po.new || exit 1
tmpfiles="$tmpfiles fr"
test -d fr || mkdir fr
test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
: ${MSGFMT=msgfmt}
${MSGFMT} -o fr/LC_MESSAGES/cake.mo fr.po
tmpfiles="$tmpfiles fr.po.tmp"
: ${MSGUNFMT=msgunfmt}
${MSGUNFMT} fr/LC_MESSAGES/cake.mo -o fr.po.tmp
tmpfiles="$tmpfiles fr.po.strip"
sed 1d < fr.po > fr.po.strip
: ${DIFF=diff}
${DIFF} fr.po.strip fr.po.tmp || exit 1
LANGUAGE=
LC_ALL=fr
LC_MESSAGES=
LANG=
export LANGUAGE LC_ALL LC_MESSAGES LANG
tmpfiles="$tmpfiles cake.ok cake.out"
: ${DIFF=diff}
echo 'un morceau de gateau' > cake.ok
./cake 1 > cake.out || exit 1
${DIFF} cake.ok cake.out || exit 1
echo '2 morceaux de gateau' > cake.ok
./cake 2 > cake.out || exit 1
${DIFF} cake.ok cake.out || exit 1
echo '10 morceaux de gateau' > cake.ok
./cake 10 > cake.out || exit 1
${DIFF} cake.ok cake.out || exit 1
rm -fr $tmpfiles
exit 0
# Preserve executable bits for this shell script.
# Thanks to Noah Friedman for this great trick.
Local Variables:
eval:(defun frobme () (set-file-modes buffer-file-name file-mode))
eval:(make-local-variable 'file-mode)
eval:(setq file-mode (file-modes (buffer-file-name)))
eval:(make-local-variable 'after-save-hook)
eval:(add-hook 'after-save-hook 'frobme)
End:
|