diff options
author | Jonas Häggqvist <rasher@rasher.dk> | 2007-09-01 20:54:17 +0000 |
---|---|---|
committer | Jonas Häggqvist <rasher@rasher.dk> | 2007-09-01 20:54:17 +0000 |
commit | 2c4438ac51b5fe3133b2fe7efae4a07fd2c76b4d (patch) | |
tree | 789069c5e958300febbf3d7d07f4758f9ae935ff | |
parent | e0651718a0403ed87647c2f54ece74519be6d10d (diff) | |
download | rockbox-2c4438ac51b5fe3133b2fe7efae4a07fd2c76b4d.tar.gz rockbox-2c4438ac51b5fe3133b2fe7efae4a07fd2c76b4d.zip |
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
-rwxr-xr-x | tools/genlang | 11 |
1 files 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]; | |||
122 | my @m; | 122 | my @m; |
123 | my $m="blank"; | 123 | my $m="blank"; |
124 | 124 | ||
125 | sub trim { | ||
126 | my ($string) = @_; | ||
127 | $string =~ s/^\s+//; | ||
128 | $string =~ s/\s+$//; | ||
129 | return $string; | ||
130 | } | ||
131 | |||
125 | sub match { | 132 | sub match { |
126 | my ($string, $pattern)=@_; | 133 | my ($string, $pattern)=@_; |
127 | 134 | ||
@@ -302,7 +309,7 @@ sub compare { | |||
302 | for my $l (@$locref) { | 309 | for my $l (@$locref) { |
303 | if($l =~ /^ *desc: (.*)/) { | 310 | if($l =~ /^ *desc: (.*)/) { |
304 | $ldesc=$1; | 311 | $ldesc=$1; |
305 | if($edesc ne $ldesc) { | 312 | if(trim($edesc) ne trim($ldesc)) { |
306 | $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; | 313 | $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; |
307 | } | 314 | } |
308 | push @show, $l; | 315 | push @show, $l; |
@@ -315,7 +322,7 @@ sub compare { | |||
315 | if($l =~ / *\<\/source\>/i) { | 322 | if($l =~ / *\<\/source\>/i) { |
316 | $mode = 0; | 323 | $mode = 0; |
317 | print @show; | 324 | print @show; |
318 | if($esource ne $lsource) { | 325 | if(trim($esource) ne trim($lsource)) { |
319 | print "### The <source> section differs from the english!\n", | 326 | print "### The <source> section differs from the english!\n", |
320 | "### the previously used one is commented below:\n"; | 327 | "### the previously used one is commented below:\n"; |
321 | for(split("\n", $lsource)) { | 328 | for(split("\n", $lsource)) { |