Merge lp:~danilo/intltool/bug-790574 into lp:intltool

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: 724
Merged at revision: 722
Proposed branch: lp:~danilo/intltool/bug-790574
Merge into: lp:intltool
Diff against target: 351 lines (+42/-109)
7 files modified
intltool-extract.in (+4/-50)
intltool-update.in (+21/-7)
tests/cases/Makefile.am (+0/-2)
tests/cases/test.scm (+0/-16)
tests/results/Makefile.am (+0/-1)
tests/results/test.scm.h (+0/-11)
tests/selftest.pl.in (+17/-22)
To merge this branch: bzr merge lp:~danilo/intltool/bug-790574
Reviewer Review Type Date Requested Status
Данило Шеган Approve
Review via email: mp+78716@code.launchpad.net

Description of the change

= Bug 790574 =

For the sake of diff generation and glancing over.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'intltool-extract.in'
2--- intltool-extract.in 2010-03-18 21:49:43 +0000
3+++ intltool-extract.in 2011-10-08 14:06:27 +0000
4@@ -163,11 +163,11 @@
5 --type=TYPE Specify the file type of FILENAME. Currently supports:
6 "gettext/glade", "gettext/ini", "gettext/keys"
7 "gettext/rfc822deb", "gettext/schemas",
8- "gettext/scheme", "gettext/xml", "gettext/quoted",
9- "gettext/quotedxml", "gettext/tlk"
10+ "gettext/xml", "gettext/quoted", "gettext/quotedxml",
11+ "gettext/tlk"
12 -l, --local Writes output into current working directory
13 (conflicts with --update)
14- --update Writes output into the same directory the source file
15+ --update Writes output into the same directory the source file
16 reside (conflicts with --local)
17 --srcdir Root of the source tree
18 -v, --version Output version information and exit
19@@ -218,7 +218,6 @@
20 &type_keys if $gettext_type eq "keys";
21 &type_xml if $gettext_type eq "xml";
22 &type_glade if $gettext_type eq "glade";
23- &type_scheme if $gettext_type eq "scheme";
24 &type_schemas if $gettext_type eq "schemas";
25 &type_rfc822deb if $gettext_type eq "rfc822deb";
26 &type_quoted if $gettext_type eq "quoted";
27@@ -790,51 +789,6 @@
28 }
29 }
30
31-sub type_scheme {
32- my ($line, $i, $state, $str, $trcomment, $char);
33- for $line (split(/\n/, $input)) {
34- $i = 0;
35- $state = 0; # 0 - nothing, 1 - string, 2 - translatable string
36- while ($i < length($line)) {
37- if (substr($line,$i,1) eq "\"") {
38- if ($state == 2) {
39- $comments{$str} = $trcomment if ($trcomment);
40- $messages{$str} = [];
41- $str = '';
42- $state = 0; $trcomment = "";
43- } elsif ($state == 1) {
44- $str = '';
45- $state = 0; $trcomment = "";
46- } else {
47- $state = 1;
48- $str = '';
49- if ($i>0 && substr($line,$i-1,1) eq '_') {
50- $state = 2;
51- }
52- }
53- } elsif (!$state) {
54- if (substr($line,$i,1) eq ";") {
55- $trcomment = substr($line,$i+1);
56- $trcomment =~ s/^;*\s*//;
57- $i = length($line);
58- } elsif ($trcomment && substr($line,$i,1) !~ /\s|\(|\)|_/) {
59- $trcomment = "";
60- }
61- } else {
62- if (substr($line,$i,1) eq "\\") {
63- $char = substr($line,$i+1,1);
64- if ($char ne "\"" && $char ne "\\") {
65- $str = $str . "\\";
66- }
67- $i++;
68- }
69- $str = $str . substr($line,$i,1);
70- }
71- $i++;
72- }
73- }
74-}
75-
76 sub type_tlk {
77 my ($ftype, $fvers, $langid, $strcount, $stroff);
78 my $count = 0;
79@@ -853,7 +807,7 @@
80 $inputa[18] . $inputa[19]);
81
82 use bytes;
83- $strdata = bytes::substr ($input, $stroff);
84+ $strdata = bytes::substr ($input, $stroff);
85
86 my $sinpos = 20;
87
88
89=== modified file 'intltool-update.in'
90--- intltool-update.in 2011-09-27 09:57:14 +0000
91+++ intltool-update.in 2011-10-08 14:06:27 +0000
92@@ -64,7 +64,6 @@
93 "ui|". # Bonobo specific - User Interface desc. files
94 "lang|". # ?
95 "glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required)
96-"scm(?:\\.in)*|". # ? (Note: .in is not required)
97 "oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files
98 "etspec|". # ?
99 "server(?:\\.in)+|". # Bonobo specific
100@@ -88,7 +87,7 @@
101 "tlk(?:\\.in)+"; # Bioware Aurora Talk Table Format
102
103 my $buildin_gettext_support =
104-"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py(?:\\.in)*";
105+"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py|scm(?:\\.in)*";
106
107 ## Always flush buffer when printing
108 $| = 1;
109@@ -451,10 +450,21 @@
110 my $in_comment = 0;
111 my $in_macro = 0;
112 my $in_string = 0;
113+ my @multiline_quotes;
114+ if ($file =~ /\.scm/) {
115+ @multiline_quotes = ('"');
116+ } else {
117+ @multiline_quotes = ("'''", '"""');
118+ }
119
120 open FILE, "<$file";
121 while (<FILE>)
122 {
123+ if ($file =~ /\.scm/) {
124+ # Strip single quotes from .scm files.
125+ s-\'--g;
126+ }
127+
128 # Handle continued multi-line comment.
129 if ($in_comment)
130 {
131@@ -465,7 +475,11 @@
132 # Handle continued multi-line string.
133 if ($in_string)
134 {
135- next unless s/.*(\'\'\'|\"\"\")//;
136+ my $pattern = join '|', @multiline_quotes;
137+ if (!s/.*$pattern//) {
138+ s///s;
139+ next;
140+ };
141 $in_string = 0;
142 }
143
144@@ -499,11 +513,11 @@
145 {
146 s-//.*--;
147 }
148- elsif ($match eq "\"\"\"" or $match eq "\'\'\'")
149+ elsif (grep($match, @multiline_quotes))
150 {
151- if (!s-$match.*?$match--)
152+ if (!s-$match(\\$match|[^$match])*$match-QUOTEDTEXT-g)
153 {
154- s-$match.*--;
155+ s-$match.*-QUOTEDTEXT-s;
156 $in_string = 1;
157 }
158 }
159@@ -529,7 +543,7 @@
160 }
161
162 ## C_ N_ NC_ Q_ and _ are the macros defined in gi8n.h
163- if (/(NC_|[NCQ]_|[^_]_|(^|$)[_]) *\(QUOTEDTEXT/m)
164+ if (/(NC_|[NCQ]_|[^_]_|(^|$)[_]) *\(?QUOTEDTEXT/m)
165 {
166 AddFileToListIfMissing($file, \@buf_allfiles);
167 last;
168
169=== modified file 'tests/cases/Makefile.am'
170--- tests/cases/Makefile.am 2010-03-24 14:25:17 +0000
171+++ tests/cases/Makefile.am 2011-10-08 14:06:27 +0000
172@@ -41,7 +41,6 @@
173 test-quoted.po \
174 test.po \
175 test.schemas.in \
176- test.scm \
177 unicodetext.xml.in \
178 $(NULL)
179
180@@ -69,7 +68,6 @@
181 test-quoted.dtd.h \
182 test.schemas \
183 test.schemas.in.h \
184- test.scm.h \
185 unicodetext.xml.in.h \
186 extract1.desktop.in \
187 extract3.xml.in.h \
188
189=== removed file 'tests/cases/test.scm'
190--- tests/cases/test.scm 2004-10-23 09:11:26 +0000
191+++ tests/cases/test.scm 1970-01-01 00:00:00 +0000
192@@ -1,16 +0,0 @@
193-;; regular comment
194-
195-("some " "basic" "strings") ; silly comment
196-(_"translatable string")
197-
198-;; _"this"
199-
200-;; nasty comment _"
201-("nasty string; haha" ; this is a fine comment for translators
202- _"nice string; thanks") ; all well
203-
204-(_"multiple" _"translations; per line")
205-
206-"not for_" _"translation" ; so "what?
207-
208-_"another \" string" "so \"what" _"here"
209
210=== modified file 'tests/results/Makefile.am'
211--- tests/results/Makefile.am 2010-03-24 14:25:17 +0000
212+++ tests/results/Makefile.am 2011-10-08 14:06:27 +0000
213@@ -37,6 +37,5 @@
214 test-quoted.dtd.h \
215 test.schemas \
216 test.schemas.in.h \
217- test.scm.h \
218 unicodetext.xml.in.h \
219 $(NULL)
220
221=== removed file 'tests/results/test.scm.h'
222--- tests/results/test.scm.h 2004-10-23 09:11:26 +0000
223+++ tests/results/test.scm.h 1970-01-01 00:00:00 +0000
224@@ -1,11 +0,0 @@
225-/* so "what? */
226-char *s = N_("another \" string");
227-char *s = N_("here");
228-/* all well */
229-char *s = N_("multiple");
230-/* this is a fine comment for translators */
231-char *s = N_("nice string; thanks");
232-/* silly comment */
233-char *s = N_("translatable string");
234-char *s = N_("translation");
235-char *s = N_("translations; per line");
236
237=== modified file 'tests/selftest.pl.in'
238--- tests/selftest.pl.in 2010-03-18 21:49:43 +0000
239+++ tests/selftest.pl.in 2011-10-08 14:06:27 +0000
240@@ -197,94 +197,89 @@
241 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
242 check_extract_result($case);
243
244-print "21. Extract messages from Scheme file: ";
245-$case = "test.scm";
246-system("$INTLTOOL_EXTRACT --type=gettext/scheme --quiet --update cases/$case") == 0 or $failed = 1;
247-check_extract_result($case);
248-
249-print "22. Merge into file with CDATA sections: ";
250+print "21. Merge into file with CDATA sections: ";
251 $case = "merge-cdata.xml";
252 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
253 check_merge_result($case);
254
255-print "23. Merge into XML file with deep translation/attribute nesting: ";
256+print "22. Merge into XML file with deep translation/attribute nesting: ";
257 $case = "merge-deepattr.xml";
258 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
259 check_merge_result($case);
260
261-print "24. Ignore empty strings from XML file ";
262+print "23. Ignore empty strings from XML file ";
263 $case = "extract12.xml.in";
264 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
265 check_extract_result($case);
266
267-print "25. Extract messages from a xml file using inherited xml:space: ";
268+print "24. Extract messages from a xml file using inherited xml:space: ";
269 $case = "space-preserve.xml.in";
270 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
271 check_extract_result($case);
272
273-print "26. Merge messages into xml file using inherited xml:space: ";
274+print "25. Merge messages into xml file using inherited xml:space: ";
275 $case = "space-preserve.xml";
276 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
277 check_merge_result($case);
278
279-print "27. Merge non-well-formed translations into xml file: ";
280+print "26. Merge non-well-formed translations into xml file: ";
281 $case = "merge11.xml";
282 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
283 check_merge_result($case);
284
285-print "28. Extract UTF-8 encoded messages/comments from xml file: ";
286+print "27. Extract UTF-8 encoded messages/comments from xml file: ";
287 $case = "unicodetext.xml.in";
288 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
289 check_extract_result($case);
290
291-print "29. Extract iso-8859-1 encoded messages/comments from xml file: ";
292+print "28. Extract iso-8859-1 encoded messages/comments from xml file: ";
293 $case = "iso88591text.xml.in";
294 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
295 check_extract_result($case);
296
297-print "30. Extract messages from a quoted style file: ";
298+print "29. Extract messages from a quoted style file: ";
299 $case = "test-quoted.dtd";
300 system("$INTLTOOL_EXTRACT --type=gettext/quoted --quiet --update cases/$case") == 0 or $failed = 1;
301 check_extract_result($case);
302
303-print "31. Merge translations into multiple quoted style files: ";
304+print "30. Merge translations into multiple quoted style files: ";
305 $case = "test-quoted.dtd";
306 system("$INTLTOOL_MERGE --quoted-style --quiet --multiple-output cases cases/$case $case") == 0 or $failed = 1;
307 check_multimerge_result($case, "test-quoted");
308
309-print "32. Extract comments for translators from a .desktop.in file: ";
310+print "31. Extract comments for translators from a .desktop.in file: ";
311 $case = "extract13.desktop.in";
312 system("$INTLTOOL_EXTRACT --type=gettext/ini --quiet --update cases/$case") == 0 or $failed = 1;
313 check_extract_result($case);
314
315-print "33. Merge translations from a .desktop.in file: ";
316+print "32. Merge translations from a .desktop.in file: ";
317 $case = "extract13.desktop.in";
318 $result = $case;
319 ($result = $case) =~ s/\.in//;
320 system("$INTLTOOL_MERGE -d --quiet cases cases/$case cases/$result") == 0 or $failed = 1;
321 check_merge_result($case);
322
323-print "34. Decode XML entities in the right order when extracting: ";
324+print "33. Decode XML entities in the right order when extracting: ";
325 $case = "extract14.xml.in";
326 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
327 check_extract_result($case);
328
329-print "35. Merge XML translations, decoding entities in the right order: ";
330+print "34. Merge XML translations, decoding entities in the right order: ";
331 $case = "merge12.xml";
332 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
333 check_merge_result($case);
334
335-print "36. Extract messages from an XML file with msgctxts: ";
336+print "35. Extract messages from an XML file with msgctxts: ";
337 $case = "context.xml.in";
338 system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
339 check_extract_result($case);
340
341-print "37. Merge translations into an XML file with msgctxts: ";
342+print "36. Merge translations into an XML file with msgctxts: ";
343 $case = "context.xml";
344 system("$INTLTOOL_MERGE -x --quiet cases cases/$case.in cases/$case") == 0 or $failed = 1;
345 check_merge_result($case);
346
347-print "38. Extract messages from an GtkBuilder XML file with msgctxts: ";
348+print "37. Extract messages from an GtkBuilder XML file with msgctxts: ";
349 $case = "extract-gtkbuilder.ui";
350 system("$INTLTOOL_EXTRACT --type=gettext/glade --quiet --update cases/$case") == 0 or $failed = 1;
351 check_extract_result($case);

Subscribers

People subscribed via source and target branches