Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-15
1 #! /bin/sh
2
3 # Test plural formula dependent checking of format strings.
4
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
7
8 # Take as example a plural formula which takes the values 0 and 2 infinitely
9 # often, and value 1 only a few times.
10 # Test: 1 - have %d everywhere - OK
11 #       2 - lack %d for value 0 - error
12 #       3 - lack %d for value 1 - OK
13 #       4 - lack %d for value 2 - error
14
15 tmpfiles="$tmpfiles mf-15.po1"
16 cat <<\EOF > mf-15.po1
17 # SOME DESCRIPTIVE TITLE.
18 # Copyright (C) YEAR Free Software Foundation, Inc.
19 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
20 #
21 msgid ""
22 msgstr ""
23 "Project-Id-Version: GNU bison\n"
24 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
25 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
26 "Language-Team: test <test@li.org>\n"
27 "Language: test\n"
28 "MIME-Version: 1.0\n"
29 "Content-Type: text/plain; charset=UTF-8\n"
30 "Content-Transfer-Encoding: 8bit\n"
31 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
32
33 #: src/reduce.c:511
34 #, c-format
35 msgid "%d useless nonterminal"
36 msgid_plural "%d useless nonterminals"
37 msgstr[0] "%d unnütze Nichtterminale"
38 msgstr[1] "%d unnützes Nichtterminal"
39 msgstr[2] "%d der unnützen Nichtterminale"
40 EOF
41
42 : ${MSGFMT=msgfmt}
43 ${MSGFMT} --check -o /dev/null mf-15.po1
44 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
45
46 tmpfiles="$tmpfiles mf-15.po2"
47 cat <<\EOF > mf-15.po2
48 # SOME DESCRIPTIVE TITLE.
49 # Copyright (C) YEAR Free Software Foundation, Inc.
50 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
51 #
52 msgid ""
53 msgstr ""
54 "Project-Id-Version: GNU bison\n"
55 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
56 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
57 "Language-Team: test <test@li.org>\n"
58 "Language: test\n"
59 "MIME-Version: 1.0\n"
60 "Content-Type: text/plain; charset=UTF-8\n"
61 "Content-Transfer-Encoding: 8bit\n"
62 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
63
64 #: src/reduce.c:511
65 #, c-format
66 msgid "%d useless nonterminal"
67 msgid_plural "%d useless nonterminals"
68 msgstr[0] "unnütze Nichtterminale"
69 msgstr[1] "%d unnützes Nichtterminal"
70 msgstr[2] "%d der unnützen Nichtterminale"
71 EOF
72
73 : ${MSGFMT=msgfmt}
74 ${MSGFMT} --check -o /dev/null mf-15.po2 2>/dev/null
75 test $? = 1 || { rm -fr $tmpfiles; exit 1; }
76
77 tmpfiles="$tmpfiles mf-15.po3"
78 cat <<\EOF > mf-15.po3
79 # SOME DESCRIPTIVE TITLE.
80 # Copyright (C) YEAR Free Software Foundation, Inc.
81 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
82 #
83 msgid ""
84 msgstr ""
85 "Project-Id-Version: GNU bison\n"
86 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
87 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
88 "Language-Team: test <test@li.org>\n"
89 "Language: test\n"
90 "MIME-Version: 1.0\n"
91 "Content-Type: text/plain; charset=UTF-8\n"
92 "Content-Transfer-Encoding: 8bit\n"
93 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
94
95 #: src/reduce.c:511
96 #, c-format
97 msgid "%d useless nonterminal"
98 msgid_plural "%d useless nonterminals"
99 msgstr[0] "%d unnütze Nichtterminale"
100 msgstr[1] "unnützes Nichtterminal"
101 msgstr[2] "%d der unnützen Nichtterminale"
102 EOF
103
104 : ${MSGFMT=msgfmt}
105 ${MSGFMT} --check -o /dev/null mf-15.po3
106 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
107
108 tmpfiles="$tmpfiles mf-15.po4"
109 cat <<\EOF > mf-15.po4
110 # SOME DESCRIPTIVE TITLE.
111 # Copyright (C) YEAR Free Software Foundation, Inc.
112 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
113 #
114 msgid ""
115 msgstr ""
116 "Project-Id-Version: GNU bison\n"
117 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
118 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
119 "Language-Team: test <test@li.org>\n"
120 "Language: test\n"
121 "MIME-Version: 1.0\n"
122 "Content-Type: text/plain; charset=UTF-8\n"
123 "Content-Transfer-Encoding: 8bit\n"
124 "Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
125
126 #: src/reduce.c:511
127 #, c-format
128 msgid "%d useless nonterminal"
129 msgid_plural "%d useless nonterminals"
130 msgstr[0] "%d unnütze Nichtterminale"
131 msgstr[1] "%d unnützes Nichtterminal"
132 msgstr[2] "der unnützen Nichtterminale"
133 EOF
134
135 : ${MSGFMT=msgfmt}
136 ${MSGFMT} --check -o /dev/null mf-15.po4 2>/dev/null
137 test $? = 1 || { rm -fr $tmpfiles; exit 1; }
138
139 rm -fr $tmpfiles
140
141 exit $result