~ubuntu-branches/ubuntu/trusty/gettext/trusty

« back to all changes in this revision

Viewing changes to tests/plural-1

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2002-04-10 13:17:42 UTC
  • Revision ID: james.westby@ubuntu.com-20020410131742-npf89tsaygdolprj
Tags: upstream-0.10.40
ImportĀ upstreamĀ versionĀ 0.10.40

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
tmpfiles=""
 
4
trap 'rm -fr $tmpfiles' 1 2 3 15
 
5
 
 
6
tmpfiles="$tmpfiles cake.pot"
 
7
: ${XGETTEXT=xgettext}
 
8
${XGETTEXT} -o cake.pot --omit-header ${top_srcdir}/tests/plural-1-prg.c
 
9
 
 
10
tmpfiles="$tmpfiles cake.ok"
 
11
cat <<EOF > cake.ok
 
12
msgid "a piece of cake"
 
13
msgid_plural "%d pieces of cake"
 
14
msgstr[0] ""
 
15
msgstr[1] ""
 
16
EOF
 
17
 
 
18
: ${DIFF=diff}
 
19
${DIFF} cake.ok cake.pot || exit 1
 
20
 
 
21
tmpfiles="$tmpfiles fr.po"
 
22
cat <<EOF > fr.po
 
23
# Les gateaux allemands sont les meilleurs du monde.
 
24
msgid "a piece of cake"
 
25
msgid_plural "%d pieces of cake"
 
26
msgstr[0] "un morceau de gateau"
 
27
msgstr[1] "%d morceaux de gateau"
 
28
EOF
 
29
 
 
30
tmpfiles="$tmpfiles fr.po.new"
 
31
: ${MSGMERGE=msgmerge}
 
32
${MSGMERGE} -q -o fr.po.new fr.po cake.pot
 
33
 
 
34
: ${DIFF=diff}
 
35
${DIFF} fr.po fr.po.new || exit 1
 
36
 
 
37
tmpfiles="$tmpfiles fr"
 
38
test -d fr || mkdir fr
 
39
test -d fr/LC_MESSAGES || mkdir fr/LC_MESSAGES
 
40
 
 
41
: ${MSGFMT=msgfmt}
 
42
${MSGFMT} -o fr/LC_MESSAGES/cake.mo fr.po
 
43
 
 
44
tmpfiles="$tmpfiles fr.po.tmp"
 
45
: ${MSGUNFMT=msgunfmt}
 
46
${MSGUNFMT} fr/LC_MESSAGES/cake.mo -o fr.po.tmp
 
47
 
 
48
tmpfiles="$tmpfiles fr.po.strip"
 
49
sed 1d < fr.po > fr.po.strip
 
50
 
 
51
: ${DIFF=diff}
 
52
${DIFF} fr.po.strip fr.po.tmp || exit 1
 
53
 
 
54
LANGUAGE=
 
55
LC_ALL=fr
 
56
LC_MESSAGES=
 
57
LANG=
 
58
export LANGUAGE LC_ALL LC_MESSAGES LANG
 
59
 
 
60
tmpfiles="$tmpfiles cake.ok cake.out"
 
61
: ${DIFF=diff}
 
62
echo 'un morceau de gateau' > cake.ok
 
63
./cake 1 > cake.out || exit 1
 
64
${DIFF} cake.ok cake.out || exit 1
 
65
echo '2 morceaux de gateau' > cake.ok
 
66
./cake 2 > cake.out || exit 1
 
67
${DIFF} cake.ok cake.out || exit 1
 
68
echo '10 morceaux de gateau' > cake.ok
 
69
./cake 10 > cake.out || exit 1
 
70
${DIFF} cake.ok cake.out || exit 1
 
71
 
 
72
rm -fr $tmpfiles
 
73
 
 
74
exit 0