diff options
Diffstat (limited to 'wpo2po.pl')
-rw-r--r-- | wpo2po.pl | 52 |
1 files changed, 30 insertions, 22 deletions
@@ -10,6 +10,13 @@ sub load_wpo { if (ref($leaf) eq 'ARRAY') { $page = load_wpo($leaf, $tag, $page); } elsif (ref($leaf) eq 'HASH') { + # XML compatibility + $leaf->{to} =~ s/\\'/\\\\'/g; + $leaf->{to} =~ s/\\q/\\\\q/g; + $leaf->{to} =~ s/\\a/\\\\a/g; + $leaf->{from} =~ s/\\'/\\\\'/g; + $leaf->{from} =~ s/\\q/\\\\q/g; + $leaf->{from} =~ s/\\a/\\\\a/g; $page->{$leaf->{from}} = $leaf->{to}; }elsif(ref($leaf)=~ /\w\D/){ $tag = $leaf; @@ -21,40 +28,41 @@ sub load_wpo { my $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]); my $wpo = load_wpo($xmltree); -my %lang = (fr => '"Language-Team: French <fr@li.org>" +my %lang = (fr => '"Language-Team: French <fr@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1" -"Content-Transfer-Encoding: 8bit"', - en => '"Language-Team: English <en@li.org>" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n"', + en => '"Language-Team: English <en@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1" -"Content-Transfer-Encoding: 8bit"', - it => '"Language-Team: Italian <it@li.org>" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n"', + it => '"Language-Team: Italian <it@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1" -"Content-Transfer-Encoding: 8bit"', - de => => '"Language-Team: Deutsh <de@li.org>" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n"', + de => => '"Language-Team: German <de@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1" -"Content-Transfer-Encoding: 8bit"', - es => => '"Language-Team: Spanish <es@li.org>" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n"', + es => => '"Language-Team: Spanish <es@li.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-1" -"Content-Transfer-Encoding: 8bit"'); +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n"'); print STDERR "$ARGV[0] =>"; -$ARGV[0] =~ /(.*\/).*\.(.*)\..*/; +$ARGV[0] =~ /.*\/(.*)\.(.*)\..*/; -open(PO, "> $1$2.po"); +open(PO, "> ./po/$1_$2.po"); my $date = `date +%Y-%m-%d\\ %H:%M\\ %z`; chomp $date; 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"}.' -"Project-Id-Version: drakwizard" -"POT-Creation-Date: '.$date.'" -"PO-Revision-Date: '.$date.'" -"Last-Translator: wpo2po <adesmons@mandrakesoft.com>" +"X-Generator: wpo2pl 0.1\n" '; @@ -70,4 +78,4 @@ foreach (keys %{$wpo}) { } close PO; -print STDERR "$1$2.po\n"; +print STDERR "./po/$1_$2.po\n"; |