From 2d5668bab5776ea7d6440ea096a852c6050a8360 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 8 Dec 2003 13:03:28 +0000 Subject: [PATCH] improving what's discarded : script & stylesheet --- misc/translator/text-extract.pl | 12 +++++++++++- misc/translator/tmpl_process.pl | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/misc/translator/text-extract.pl b/misc/translator/text-extract.pl index a13caff459..f876e78195 100755 --- a/misc/translator/text-extract.pl +++ b/misc/translator/text-extract.pl @@ -9,10 +9,20 @@ getopt("f:"); my $x = $_[0]; foreach my $c ($x->content_list) { next if (ref($c) && $c->tag() eq "~comment"); - print "$c\n" unless ref($c); + next if (ref($c) && $c->tag() eq "script"); + next if (ref($c) && $c->tag() eq "style"); + if (!ref($c)) { + print "$c\n"; + } if (ref($c) && $c->attr('alt')) { print $c->attr('alt')."\n"; } + if (ref($c) && $c->attr('title')) { + print $c->attr('title')."\n"; + } + if (ref($c) && $c->tag() eq "input" && $c->attr('value')) { + print $c->attr('value')."\n"; + } if (ref($c) && $c->tag() eq 'meta') { print $c->attr('content')."\n "; } diff --git a/misc/translator/tmpl_process.pl b/misc/translator/tmpl_process.pl index 8ecc045fa7..e50bcb7d30 100755 --- a/misc/translator/tmpl_process.pl +++ b/misc/translator/tmpl_process.pl @@ -233,7 +233,7 @@ sub update_strhash if( !defined(%{$strhash}->{$str}) ) { # the line is not already in the list so add it - %{$strhash}->{$str} = 1; + %{$strhash}->{$str}=1; } } } @@ -262,9 +262,9 @@ sub restore_strhash while( my $line = <$fh> ) { chomp $line; - + # extracts the two fields - my ($original, $translated) = split(/$split_char/, $line, 2); + my ($original, $translated,$nb) = split(/$split_char/, $line, 3); if($translated ne "") { @@ -276,11 +276,11 @@ sub restore_strhash # the key exist but has no translation. %{$strhash}->{$original} = 1; } - + } - + close($fh); - + return %{$strhash}; } -- 2.39.2