improving what's discarded : script & stylesheet
authortipaul <tipaul>
Mon, 8 Dec 2003 13:03:28 +0000 (13:03 +0000)
committertipaul <tipaul>
Mon, 8 Dec 2003 13:03:28 +0000 (13:03 +0000)
misc/translator/text-extract.pl
misc/translator/tmpl_process.pl

index a13caff..f876e78 100755 (executable)
@@ -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 ";
                        }
index 8ecc045..e50bcb7 100755 (executable)
@@ -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};
 }