From ce7c2100749af1b94c151b4d002ed3317b84dc2f Mon Sep 17 00:00:00 2001 From: Michi Henning Date: Mon, 24 Nov 2014 12:37:01 +1000 Subject: Fixed incorrect handling of spaces around = in .ini files. --- intltool-extract.in | 2 +- intltool-merge.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/intltool-extract.in b/intltool-extract.in index 45a969c..47a539b 100644 --- a/intltool-extract.in +++ b/intltool-extract.in @@ -276,7 +276,7 @@ sub add_message sub type_ini { ### For generic translatable desktop files ### - while ($input =~ /^(#(.+)\n)?^_.*=(.*)$/mg) { + while ($input =~ /^(#(.+)\n)?^_[A-Za-z0-9\-]+\s*=\s*(.*)$/mg) { if (defined($2)) { $comments{$3} = $2; } diff --git a/intltool-merge.in b/intltool-merge.in index 1afa2a4..05db7cf 100644 --- a/intltool-merge.in +++ b/intltool-merge.in @@ -1186,7 +1186,7 @@ sub desktop_merge_translations while () { - if (s/^(\s*)_([A-Za-z0-9\-]+=(.*))/$1$2/) + if (s/^(\s*)_([A-Za-z0-9\-]+\s*=\s*(.*))/$1$2/) { my $string = $3; @@ -1200,7 +1200,7 @@ sub desktop_merge_translations next if !$translation; $_ = $non_translated_line; - s/(\w+)=.*/${1}[$lang]=$translation/; + s/(\w+)\s*=\s*.*/${1}[$lang]=$translation/; print OUTPUT; } } -- cgit v1.2.1 From 1a494da1f91de39557c908c8ab99e76d14755f67 Mon Sep 17 00:00:00 2001 From: Michi Henning Date: Thu, 4 Dec 2014 09:12:57 +1000 Subject: Added test cases for spaces around = in desktop files. --- tests/cases/extract13.desktop.in | 3 +++ tests/results/extract13.desktop | 3 +++ tests/results/extract13.desktop.in.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/tests/cases/extract13.desktop.in b/tests/cases/extract13.desktop.in index 19021be..256935f 100644 --- a/tests/cases/extract13.desktop.in +++ b/tests/cases/extract13.desktop.in @@ -24,3 +24,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=gnome-utils X-GNOME-Bugzilla-Component=gsearchtool _X-Color=Blue +_X-Color2 = Red +_X-Color3= Green +_X-Color4 =Yellow diff --git a/tests/results/extract13.desktop b/tests/results/extract13.desktop index e8b60a1..879fcc1 100644 --- a/tests/results/extract13.desktop +++ b/tests/results/extract13.desktop @@ -24,3 +24,6 @@ X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=gnome-utils X-GNOME-Bugzilla-Component=gsearchtool X-Color=Blue +X-Color2 = Red +X-Color3= Green +X-Color4 =Yellow diff --git a/tests/results/extract13.desktop.in.h b/tests/results/extract13.desktop.in.h index e9df7b9..9e44646 100644 --- a/tests/results/extract13.desktop.in.h +++ b/tests/results/extract13.desktop.in.h @@ -3,3 +3,6 @@ char *s = N_("Find Files..."); /* 4. This comment also should be extracted. */ char *s = N_("Locate documents and folders on this computer by name or content"); char *s = N_("Blue"); +char *s = N_("Red"); +char *s = N_("Green"); +char *s = N_("Yellow"); -- cgit v1.2.1