Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / msgfmt-17
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test range dependent checking of format strings with plural forms.
5
6 # Take as example a plural formula which takes all values infinitely often.
7 # Test: 1 - lack %d for value 0 - error
8 #       2 - lack %d for value 0 but limited range such that only one n - ok
9 #       3 - lack %d for value 1 - error
10 #       4 - lack %d for value 1 but limited range such that multiple n - error
11
12 cat <<\EOF > mf-17.po1
13 # SOME DESCRIPTIVE TITLE.
14 # Copyright (C) YEAR Free Software Foundation, Inc.
15 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
16 #
17 msgid ""
18 msgstr ""
19 "Project-Id-Version: GNU bison\n"
20 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
21 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
22 "Language-Team: test <test@li.org>\n"
23 "Language: test\n"
24 "MIME-Version: 1.0\n"
25 "Content-Type: text/plain; charset=UTF-8\n"
26 "Content-Transfer-Encoding: 8bit\n"
27 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
28
29 #: ../roundup/date.py:851
30 #, python-format
31 msgid "1 %(number)s/4 hours"
32 msgid_plural "1 %(number)s/4 hours"
33 msgstr[0] "час с четвертью"
34 msgstr[1] "час и %(number)s четверти"
35 msgstr[2] "час и %(number)s четвертей"
36 EOF
37
38 : ${MSGFMT=msgfmt}
39 ${MSGFMT} --check -o /dev/null mf-17.po1 2>/dev/null
40 test $? = 1 || { exit 1; }
41
42 cat <<\EOF > mf-17.po2
43 # SOME DESCRIPTIVE TITLE.
44 # Copyright (C) YEAR Free Software Foundation, Inc.
45 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
46 #
47 msgid ""
48 msgstr ""
49 "Project-Id-Version: GNU bison\n"
50 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
51 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
52 "Language-Team: test <test@li.org>\n"
53 "Language: test\n"
54 "MIME-Version: 1.0\n"
55 "Content-Type: text/plain; charset=UTF-8\n"
56 "Content-Transfer-Encoding: 8bit\n"
57 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
58
59 #: ../roundup/date.py:851
60 #, python-format, range: 1..3
61 msgid "1 %(number)s/4 hours"
62 msgid_plural "1 %(number)s/4 hours"
63 msgstr[0] "час с четвертью"
64 msgstr[1] "час и %(number)s четверти"
65 msgstr[2] "час и %(number)s четвертей"
66 EOF
67
68 : ${MSGFMT=msgfmt}
69 ${MSGFMT} --check -o /dev/null mf-17.po2 || exit 1
70
71 cat <<\EOF > mf-17.po3
72 # SOME DESCRIPTIVE TITLE.
73 # Copyright (C) YEAR Free Software Foundation, Inc.
74 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
75 #
76 msgid ""
77 msgstr ""
78 "Project-Id-Version: GNU bison\n"
79 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
80 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
81 "Language-Team: test <test@li.org>\n"
82 "Language: test\n"
83 "MIME-Version: 1.0\n"
84 "Content-Type: text/plain; charset=UTF-8\n"
85 "Content-Transfer-Encoding: 8bit\n"
86 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
87
88 #: ../roundup/date.py:851
89 #, python-format
90 msgid "1 %(number)s/4 hours"
91 msgid_plural "1 %(number)s/4 hours"
92 msgstr[0] "час и %(number)s четверти"
93 msgstr[1] "час с четвертью"
94 msgstr[2] "час и %(number)s четвертей"
95 EOF
96
97 : ${MSGFMT=msgfmt}
98 ${MSGFMT} --check -o /dev/null mf-17.po3 2>/dev/null
99 test $? = 1 || { exit 1; }
100
101 cat <<\EOF > mf-17.po4
102 # SOME DESCRIPTIVE TITLE.
103 # Copyright (C) YEAR Free Software Foundation, Inc.
104 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
105 #
106 msgid ""
107 msgstr ""
108 "Project-Id-Version: GNU bison\n"
109 "PO-Revision-Date: 2001-04-05 19:47+0200\n"
110 "Last-Translator: ABC DEF <abc@gnu.uucp>\n"
111 "Language-Team: test <test@li.org>\n"
112 "Language: test\n"
113 "MIME-Version: 1.0\n"
114 "Content-Type: text/plain; charset=UTF-8\n"
115 "Content-Transfer-Encoding: 8bit\n"
116 "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
117
118 #: ../roundup/date.py:851
119 #, python-format, range: 1..3
120 msgid "1 %(number)s/4 hours"
121 msgid_plural "1 %(number)s/4 hours"
122 msgstr[0] "час и %(number)s четверти"
123 msgstr[1] "час с четвертью"
124 msgstr[2] "час и %(number)s четвертей"
125 EOF
126
127 : ${MSGFMT=msgfmt}
128 ${MSGFMT} --check -o /dev/null mf-17.po4 2>/dev/null
129 test $? = 1 || { exit 1; }
130
131 exit $result