diff options
Diffstat (limited to 'wpo2po.pl')
-rw-r--r-- | wpo2po.pl | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -4,7 +4,7 @@ use XML::Parser; sub load_wpo { - my ($tree, $tag ,$page) = @_; + my ($tree, $tag, $page) = @_; foreach my $leaf (@$tree) { if (ref($leaf) eq 'ARRAY') { @@ -18,7 +18,7 @@ sub load_wpo { $leaf->{from} =~ s/\\q/\\\\q/g; $leaf->{from} =~ s/\\a/\\\\a/g; $page->{$leaf->{from}} = $leaf->{to}; - }elsif(ref($leaf)=~ /\w\D/){ + } elsif (ref($leaf) =~ /\w\D/) { $tag = $leaf; } } @@ -50,32 +50,33 @@ my %lang = (fr => '"Language-Team: French <fr@li.org>\n" "Content-Transfer-Encoding: 8bit\n"'); print STDERR "$ARGV[0] =>"; -$ARGV[0] =~ /.*\/(.*)\.(.*)\..*/; +$ARGV[0] =~ m!.*/(.*)\.(.*)\.!; -open(PO, "> ./po/$1_$2.po"); +my $PO; +open($PO, "> ./po/$1_$2.po"); my $date = `date +%Y-%m-%d\\ %H:%M%z`; chomp $date; -print PO 'msgid "" +print $PO 'msgid "" msgstr "" "Project-Id-Version: drakwizard 0.1\n" "POT-Creation-Date: '.$date.'\n" "PO-Revision-Date: '.$date.'\n" "Last-Translator: Arnaud Desmons <adesmons@mandrakesoft.com>\n" -'.$lang{"$2"}.' +'.$lang{$2}.' "X-Generator: wpo2pl 0.1\n" '; -foreach (keys %{$wpo}) { +foreach (keys %$wpo) { if ($_ ne "") { if ($_ eq $wpo->{$_}) { - print PO "msgid \"$_\"\nmsgstr \"\"\n\n"; + print $PO qq(msgid "$_"\nmsgstr ""\n\n); } else { - print PO "msgid \"$_\"\nmsgstr \"$wpo->{$_}\"\n\n"; + print $PO qq(msgid "$_"\nmsgstr "$wpo->{$_}"\n\n); } } } -close PO; +close $PO; print STDERR "./po/$1_$2.po\n"; |