Merge lp:~michihenning/intltool/fix-ini-spaces into lp:intltool

Proposed by Michi Henning
Status: Merged
Approved by: dobey
Approved revision: 746
Merged at revision: 745
Proposed branch: lp:~michihenning/intltool/fix-ini-spaces
Merge into: lp:intltool
Diff against target: 67 lines (+12/-3)
5 files modified
intltool-extract.in (+1/-1)
intltool-merge.in (+2/-2)
tests/cases/extract13.desktop.in (+3/-0)
tests/results/extract13.desktop (+3/-0)
tests/results/extract13.desktop.in.h (+3/-0)
To merge this branch: bzr merge lp:~michihenning/intltool/fix-ini-spaces
Reviewer Review Type Date Requested Status
dobey (community) Approve
Review via email: mp+242608@code.launchpad.net

Commit message

Fixed incorrect handling of spaces around = in .ini files.

Description of the change

Fixed incorrect handling of spaces around = in .ini files.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

A regression test (or few) needs to be added for this. I realize the test framework is a bit of a hack right now, so if you need help understanding what to do here, just ask.

review: Needs Fixing
746. By Michi Henning

Added test cases for spaces around = in desktop files.

Revision history for this message
Michi Henning (michihenning) wrote :

OK, cool, I've added test cases for space before and after =, before = only, and after = only.

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Michi Henning (michihenning) wrote :

Thanks for that. How is the fix going to make its way upstream? Can you help with that?

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 2013-05-10 01:58:40 +0000
3+++ intltool-extract.in 2014-12-03 23:13:54 +0000
4@@ -276,7 +276,7 @@
5
6 sub type_ini {
7 ### For generic translatable desktop files ###
8- while ($input =~ /^(#(.+)\n)?^_.*=(.*)$/mg) {
9+ while ($input =~ /^(#(.+)\n)?^_[A-Za-z0-9\-]+\s*=\s*(.*)$/mg) {
10 if (defined($2)) {
11 $comments{$3} = $2;
12 }
13
14=== modified file 'intltool-merge.in'
15--- intltool-merge.in 2011-10-08 14:54:41 +0000
16+++ intltool-merge.in 2014-12-03 23:13:54 +0000
17@@ -1186,7 +1186,7 @@
18
19 while (<INPUT>)
20 {
21- if (s/^(\s*)_([A-Za-z0-9\-]+=(.*))/$1$2/)
22+ if (s/^(\s*)_([A-Za-z0-9\-]+\s*=\s*(.*))/$1$2/)
23 {
24 my $string = $3;
25
26@@ -1200,7 +1200,7 @@
27 next if !$translation;
28
29 $_ = $non_translated_line;
30- s/(\w+)=.*/${1}[$lang]=$translation/;
31+ s/(\w+)\s*=\s*.*/${1}[$lang]=$translation/;
32 print OUTPUT;
33 }
34 }
35
36=== modified file 'tests/cases/extract13.desktop.in'
37--- tests/cases/extract13.desktop.in 2008-08-25 03:06:45 +0000
38+++ tests/cases/extract13.desktop.in 2014-12-03 23:13:54 +0000
39@@ -24,3 +24,6 @@
40 X-GNOME-Bugzilla-Product=gnome-utils
41 X-GNOME-Bugzilla-Component=gsearchtool
42 _X-Color=Blue
43+_X-Color2 = Red
44+_X-Color3= Green
45+_X-Color4 =Yellow
46
47=== modified file 'tests/results/extract13.desktop'
48--- tests/results/extract13.desktop 2008-08-25 03:06:45 +0000
49+++ tests/results/extract13.desktop 2014-12-03 23:13:54 +0000
50@@ -24,3 +24,6 @@
51 X-GNOME-Bugzilla-Product=gnome-utils
52 X-GNOME-Bugzilla-Component=gsearchtool
53 X-Color=Blue
54+X-Color2 = Red
55+X-Color3= Green
56+X-Color4 =Yellow
57
58=== modified file 'tests/results/extract13.desktop.in.h'
59--- tests/results/extract13.desktop.in.h 2011-10-08 13:49:14 +0000
60+++ tests/results/extract13.desktop.in.h 2014-12-03 23:13:54 +0000
61@@ -3,3 +3,6 @@
62 /* 4. This comment also should be extracted. */
63 char *s = N_("Locate documents and folders on this computer by name or content");
64 char *s = N_("Blue");
65+char *s = N_("Red");
66+char *s = N_("Green");
67+char *s = N_("Yellow");

Subscribers

People subscribed via source and target branches