blob: 8d3e8e3b4e4494daa68c30020b4beb3287729a35 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test of Vala support.
: ${XGETTEXT=xgettext}
cat <<\EOF > xg-vala-1.err.vala
int main (string[] args) {
var r1 = /a
EOF
(LANGUAGE= LC_ALL=C ${XGETTEXT} --no-location -o - xg-vala-1.err.vala 2>&1; exit) | grep 'regular expression literal terminated too early' || Exit 1
cat <<\EOF > xg-vala-1.vala
int main (string[] args) {
var s1 = "Simple string, " + " no gettext needed";
var c1 = '\'';
var empty = "";
// This is a C++ style comment
var s2 = _("Extract this first string");
var s3 = "Prefix _(" + _("Extract this second string") + ") Postfix";
var empty_verbatim = """""";
if (args[0] == _("Extract this thirth string")) {
/* _("This is a comment and must not be extracted!") */
}
var s4 = _("""Extract this
""\a
fourth string""");
var s5 = _("Extract this \u2464th string");
var s6 = /_("This is a regex literal and must not be extracted!")\|/i;
var i1 = 1000;
i1 = 1 + /_("Regex literal after '+'")/.get_capture_count ();
i1 = 1 - /_("Regex literal after '-'")/.get_capture_count ();
i1 = 1 & /_("Regex literal after '-'")/.get_capture_count ();
i1 = 1 ^ /_("Regex literal after '^'")/.get_capture_count ();
if (1 < /_("Regex literal after '<'")/.get_capture_count ())
return 1;
if (1 <= /_("Regex literal after '<='")/.get_capture_count ())
return 1;
if (1 != /_("Regex literal after '!='")/.get_capture_count ())
return 1;
if (! /_("Regex literal after '!'")/.match(s1))
return 1;
if (true && /_("Regex literal after '&&'")/.match(s1))
return 1;
if (false || /_("Regex literal after '||'")/.match(s1))
return 1;
var r1 = true ? /_("Regex literal after '?'")/ :
/_("Regex literal after ':'")/;
var r2 = true ?? /_("Regex literal after '??'")/;
i1 += 1 << /_("Regex literal after '+='")/.get_capture_count ();
i1 *= /_("Regex literal after '*='")/.get_capture_count ();
i1 /= /_("Regex literal after '/='")/.get_capture_count ();
i1 %= /_("Regex literal after '%='")/.get_capture_count ();
i1 <<= /_("Regex literal after '<<='")/.get_capture_count ();
i1 |= /_("Regex literal after '|='")/.get_capture_count ();
i1++;
i1--;
i1 = i1 / i1;
GLib.Timeout.add (10, () => { return false; });
var d1 = 10e-1;
var d2 = 10E-1;
/* This is a
multiline C style comment */
var s7 = _("Extract this //sixth string");
var s8 = _(@"This is a template string, which cannot be extracted!");
/* /= shouldn't start a regex literal */
var i5 = 1000;
i5 /= 10;
return 0;
}
class Foo : Object {
// @ isn't always followed by a template string.
public static Foo @new (void) {
return null;
}
}
EOF
${XGETTEXT} --add-comments --no-location -o xg-vala-1.tmp xg-vala-1.vala 2>xg-vala-1.err
test $? = 0 || { cat xg-vala-1.err; Exit 1; }
# Don't simplify this to "grep ... < xg-vala-1.tmp", otherwise OpenBSD 4.0 grep
# only outputs "Binary file (standard input) matches".
cat xg-vala-1.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-vala-1.pot
cat <<\EOF > xg-vala-1.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. This is a C++ style comment
msgid "Extract this first string"
msgstr ""
msgid "Extract this second string"
msgstr ""
msgid "Extract this thirth string"
msgstr ""
msgid ""
"Extract this\n"
" \"\"\\a\n"
" fourth string"
msgstr ""
msgid "Extract this ⑤th string"
msgstr ""
#. This is a
#. multiline C style comment
msgid "Extract this //sixth string"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} xg-vala-1.ok xg-vala-1.pot
result=$?
test $result = 0 || exit $result
# Test --extract-all option.
${XGETTEXT} --extract-all --add-comments --no-location -o xg-vala-1.tmp xg-vala-1.vala 2>xg-vala-1.err
test $? = 0 || { cat xg-vala-1.err; Exit 1; }
# Don't simplify this to "grep ... < xg-vala-1.tmp", otherwise OpenBSD 4.0 grep
# only outputs "Binary file (standard input) matches".
cat xg-vala-1.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-vala-1.pot
cat <<\EOF > xg-vala-1.all.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "Simple string, no gettext needed"
msgstr ""
#. This is a C++ style comment
msgid "Extract this first string"
msgstr ""
msgid "Prefix _("
msgstr ""
msgid "Extract this second string"
msgstr ""
msgid ") Postfix"
msgstr ""
msgid "Extract this thirth string"
msgstr ""
msgid ""
"Extract this\n"
" \"\"\\a\n"
" fourth string"
msgstr ""
msgid "Extract this ⑤th string"
msgstr ""
#. This is a
#. multiline C style comment
msgid "Extract this //sixth string"
msgstr ""
EOF
${DIFF} xg-vala-1.all.ok xg-vala-1.pot
result=$?
test $result = 0 || exit $result
|