From 2c4438ac51b5fe3133b2fe7efae4a07fd2c76b4d Mon Sep 17 00:00:00 2001 From: Jonas Häggqvist Date: Sat, 1 Sep 2007 20:54:17 +0000 Subject: Make genlang ignore leading and trailing whitespace in source and desc lines (not the strings). If this behavior is unwanted, feel free to revert. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14567 a1c6a512-1295-4272-9138-f99709370657 --- tools/genlang | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/genlang b/tools/genlang index 4c0a9d6564..9be77a6030 100755 --- a/tools/genlang +++ b/tools/genlang @@ -122,6 +122,13 @@ my $input = $ARGV[0]; my @m; my $m="blank"; +sub trim { + my ($string) = @_; + $string =~ s/^\s+//; + $string =~ s/\s+$//; + return $string; +} + sub match { my ($string, $pattern)=@_; @@ -302,7 +309,7 @@ sub compare { for my $l (@$locref) { if($l =~ /^ *desc: (.*)/) { $ldesc=$1; - if($edesc ne $ldesc) { + if(trim($edesc) ne trim($ldesc)) { $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; } push @show, $l; @@ -315,7 +322,7 @@ sub compare { if($l =~ / *\<\/source\>/i) { $mode = 0; print @show; - if($esource ne $lsource) { + if(trim($esource) ne trim($lsource)) { print "### The section differs from the english!\n", "### the previously used one is commented below:\n"; for(split("\n", $lsource)) { -- cgit v1.2.3