xgettext-6 revision 1.1.1.1 1 1.1 christos #!/bin/sh
2 1.1 christos
3 1.1 christos # Test of position dependent recognition of format strings.
4 1.1 christos
5 1.1 christos tmpfiles=""
6 1.1 christos trap 'rm -fr $tmpfiles' 1 2 3 15
7 1.1 christos
8 1.1 christos tmpfiles="$tmpfiles xg-test6.c"
9 1.1 christos cat <<\EOF > xg-test6.c
10 1.1 christos fprintf (fp, gettext ("c-format positive1"), gettext ("c-format negative1"));
11 1.1 christos printk (gettext ("c-format negative2"));
12 1.1 christos EOF
13 1.1 christos
14 1.1 christos tmpfiles="$tmpfiles xg-test6.sh"
15 1.1 christos cat <<\EOF > xg-test6.sh
16 1.1 christos eval_gettext "sh-format positive1" "`gettext \"sh-format negative1\"`"
17 1.1 christos echo "`gettext \"sh-format negative2\"`"
18 1.1 christos EOF
19 1.1 christos
20 1.1 christos tmpfiles="$tmpfiles xg-test6.py"
21 1.1 christos cat <<\EOF > xg-test6.py
22 1.1 christos my_printf (gettext ("python-format positive1"),
23 1.1 christos gettext ("python-format negative1"));
24 1.1 christos printk (gettext ("python-format negative2"));
25 1.1 christos EOF
26 1.1 christos
27 1.1 christos tmpfiles="$tmpfiles xg-test6.lisp"
28 1.1 christos cat <<\EOF > xg-test6.lisp
29 1.1 christos (format t (gettext "lisp-format positive1") (gettext "lisp-format negative1"))
30 1.1 christos (prin1 (gettext "lisp-format negative2"))
31 1.1 christos EOF
32 1.1 christos
33 1.1 christos tmpfiles="$tmpfiles xg-test6.el"
34 1.1 christos cat <<\EOF > xg-test6.el
35 1.1 christos (format (_ "elisp-format positive1") (_ "elisp-format negative1"))
36 1.1 christos (printk (_ "elisp-format negative2"))
37 1.1 christos EOF
38 1.1 christos
39 1.1 christos tmpfiles="$tmpfiles xg-test6.jl"
40 1.1 christos cat <<\EOF > xg-test6.jl
41 1.1 christos (format stream (_ "librep-format positive1") (_ "librep-format negative1"))
42 1.1 christos (printk (_ "librep-format negative2"))
43 1.1 christos EOF
44 1.1 christos
45 1.1 christos tmpfiles="$tmpfiles xg-test6.java"
46 1.1 christos cat <<\EOF > xg-test6.java
47 1.1 christos MessageFormat.format(gettext("java-format positive1"),
48 1.1 christos gettext("java-format negative1"));
49 1.1 christos System.err.println(gettext("java-format negative2"));
50 1.1 christos EOF
51 1.1 christos
52 1.1 christos tmpfiles="$tmpfiles xg-test6.awk"
53 1.1 christos cat <<\EOF > xg-test6.awk
54 1.1 christos printf dcgettext ("awk-format positive1"), dcgettext ("awk-format negative1");
55 1.1 christos printf (dcgettext ("awk-format positive2"), dcgettext ("awk-format negative2"));
56 1.1 christos printf dcgettext ("awk-format positive3"); dcgettext ("awk-format negative3");
57 1.1 christos printk dcgettext ("awk-format negative4");
58 1.1 christos EOF
59 1.1 christos
60 1.1 christos tmpfiles="$tmpfiles xg-test6.ycp"
61 1.1 christos cat <<\EOF > xg-test6.ycp
62 1.1 christos sformat (_("ycp-format positive1"), _("ycp-format negative1"));
63 1.1 christos printk (_("ycp-format negative2"));
64 1.1 christos EOF
65 1.1 christos
66 1.1 christos tmpfiles="$tmpfiles xg-test6.tcl"
67 1.1 christos cat <<\EOF > xg-test6.tcl
68 1.1 christos [format [::msgcat::mc "tcl-format positive1"]
69 1.1 christos [::msgcat::mc "tcl-format negative1"]]
70 1.1 christos [print [::msgcat::mc "tcl-format negative2"]]
71 1.1 christos EOF
72 1.1 christos
73 1.1 christos tmpfiles="$tmpfiles xg-test6.pl"
74 1.1 christos cat <<\EOF > xg-test6.pl
75 1.1 christos printf gettext "perl-format positive1", gettext ("perl-format negative1");
76 1.1 christos gettext ("perl-format negative2");
77 1.1 christos printf gettext "perl-format positive2"; gettext ("perl-format negative3");
78 1.1 christos gettext ("perl-format negative4");
79 1.1 christos print sprintf gettext "perl-format positive3";
80 1.1 christos print kprintf gettext "perl-format negative5";
81 1.1 christos EOF
82 1.1 christos
83 1.1 christos tmpfiles="$tmpfiles xg-test6.php"
84 1.1 christos cat <<\EOF > xg-test6.php
85 1.1 christos <? php
86 1.1 christos printf (_ ("php-format positive1"), _ ("php-format negative1"));
87 1.1 christos printk (_ ("php-format negative2"));
88 1.1 christos EOF
89 1.1 christos
90 1.1 christos tmpfiles="$tmpfiles xg-test6.po"
91 1.1 christos : ${XGETTEXT=xgettext}
92 1.1 christos ${XGETTEXT} --omit-header --no-location -d xg-test6 \
93 1.1 christos --flag=my_printf:1:python-format \
94 1.1 christos xg-test6.c xg-test6.sh xg-test6.py xg-test6.lisp xg-test6.el \
95 1.1 christos xg-test6.jl xg-test6.java xg-test6.awk xg-test6.ycp xg-test6.tcl \
96 1.1 christos xg-test6.pl xg-test6.php
97 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
98 1.1 christos
99 1.1 christos tmpfiles="$tmpfiles xg-test6.ok"
100 1.1 christos cat <<\EOF > xg-test6.ok
101 1.1 christos #, c-format
102 1.1 christos msgid "c-format positive1"
103 1.1 christos msgstr ""
104 1.1 christos
105 1.1 christos msgid "c-format negative1"
106 1.1 christos msgstr ""
107 1.1 christos
108 1.1 christos msgid "c-format negative2"
109 1.1 christos msgstr ""
110 1.1 christos
111 1.1 christos #, sh-format
112 1.1 christos msgid "sh-format positive1"
113 1.1 christos msgstr ""
114 1.1 christos
115 1.1 christos msgid "sh-format negative1"
116 1.1 christos msgstr ""
117 1.1 christos
118 1.1 christos msgid "sh-format negative2"
119 1.1 christos msgstr ""
120 1.1 christos
121 1.1 christos #, python-format
122 1.1 christos msgid "python-format positive1"
123 1.1 christos msgstr ""
124 1.1 christos
125 1.1 christos msgid "python-format negative1"
126 1.1 christos msgstr ""
127 1.1 christos
128 1.1 christos msgid "python-format negative2"
129 1.1 christos msgstr ""
130 1.1 christos
131 1.1 christos #, lisp-format
132 1.1 christos msgid "lisp-format positive1"
133 1.1 christos msgstr ""
134 1.1 christos
135 1.1 christos msgid "lisp-format negative1"
136 1.1 christos msgstr ""
137 1.1 christos
138 1.1 christos msgid "lisp-format negative2"
139 1.1 christos msgstr ""
140 1.1 christos
141 1.1 christos #, elisp-format
142 1.1 christos msgid "elisp-format positive1"
143 1.1 christos msgstr ""
144 1.1 christos
145 1.1 christos msgid "elisp-format negative1"
146 1.1 christos msgstr ""
147 1.1 christos
148 1.1 christos msgid "elisp-format negative2"
149 1.1 christos msgstr ""
150 1.1 christos
151 1.1 christos #, librep-format
152 1.1 christos msgid "librep-format positive1"
153 1.1 christos msgstr ""
154 1.1 christos
155 1.1 christos msgid "librep-format negative1"
156 1.1 christos msgstr ""
157 1.1 christos
158 1.1 christos msgid "librep-format negative2"
159 1.1 christos msgstr ""
160 1.1 christos
161 1.1 christos #, java-format
162 1.1 christos msgid "java-format positive1"
163 1.1 christos msgstr ""
164 1.1 christos
165 1.1 christos msgid "java-format negative1"
166 1.1 christos msgstr ""
167 1.1 christos
168 1.1 christos msgid "java-format negative2"
169 1.1 christos msgstr ""
170 1.1 christos
171 1.1 christos #, awk-format
172 1.1 christos msgid "awk-format positive1"
173 1.1 christos msgstr ""
174 1.1 christos
175 1.1 christos msgid "awk-format negative1"
176 1.1 christos msgstr ""
177 1.1 christos
178 1.1 christos #, awk-format
179 1.1 christos msgid "awk-format positive2"
180 1.1 christos msgstr ""
181 1.1 christos
182 1.1 christos msgid "awk-format negative2"
183 1.1 christos msgstr ""
184 1.1 christos
185 1.1 christos #, awk-format
186 1.1 christos msgid "awk-format positive3"
187 1.1 christos msgstr ""
188 1.1 christos
189 1.1 christos msgid "awk-format negative3"
190 1.1 christos msgstr ""
191 1.1 christos
192 1.1 christos msgid "awk-format negative4"
193 1.1 christos msgstr ""
194 1.1 christos
195 1.1 christos #, ycp-format
196 1.1 christos msgid "ycp-format positive1"
197 1.1 christos msgstr ""
198 1.1 christos
199 1.1 christos msgid "ycp-format negative1"
200 1.1 christos msgstr ""
201 1.1 christos
202 1.1 christos msgid "ycp-format negative2"
203 1.1 christos msgstr ""
204 1.1 christos
205 1.1 christos #, tcl-format
206 1.1 christos msgid "tcl-format positive1"
207 1.1 christos msgstr ""
208 1.1 christos
209 1.1 christos msgid "tcl-format negative1"
210 1.1 christos msgstr ""
211 1.1 christos
212 1.1 christos msgid "tcl-format negative2"
213 1.1 christos msgstr ""
214 1.1 christos
215 1.1 christos #, perl-format
216 1.1 christos msgid "perl-format positive1"
217 1.1 christos msgstr ""
218 1.1 christos
219 1.1 christos msgid "perl-format negative1"
220 1.1 christos msgstr ""
221 1.1 christos
222 1.1 christos msgid "perl-format negative2"
223 1.1 christos msgstr ""
224 1.1 christos
225 1.1 christos #, perl-format
226 1.1 christos msgid "perl-format positive2"
227 1.1 christos msgstr ""
228 1.1 christos
229 1.1 christos msgid "perl-format negative3"
230 1.1 christos msgstr ""
231 1.1 christos
232 1.1 christos msgid "perl-format negative4"
233 1.1 christos msgstr ""
234 1.1 christos
235 1.1 christos #, perl-format
236 1.1 christos msgid "perl-format positive3"
237 1.1 christos msgstr ""
238 1.1 christos
239 1.1 christos msgid "perl-format negative5"
240 1.1 christos msgstr ""
241 1.1 christos
242 1.1 christos #, php-format
243 1.1 christos msgid "php-format positive1"
244 1.1 christos msgstr ""
245 1.1 christos
246 1.1 christos msgid "php-format negative1"
247 1.1 christos msgstr ""
248 1.1 christos
249 1.1 christos msgid "php-format negative2"
250 1.1 christos msgstr ""
251 1.1 christos EOF
252 1.1 christos
253 1.1 christos : ${DIFF=diff}
254 1.1 christos ${DIFF} xg-test6.ok xg-test6.po
255 1.1 christos result=$?
256 1.1 christos
257 1.1 christos rm -fr $tmpfiles
258 1.1 christos
259 1.1 christos exit $result
260