summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-08 16:40:04 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-08 16:40:04 +0000
commit9842dab5de4a22772bb844b498e1b5976aca4563 (patch)
tree146844de6c6b21f43dee9083e552773db5cfddb5
parent770dfe071cdb5dee69a267858275048486f0175d (diff)
downloaddrakwizard-9842dab5de4a22772bb844b498e1b5976aca4563.tar
drakwizard-9842dab5de4a22772bb844b498e1b5976aca4563.tar.gz
drakwizard-9842dab5de4a22772bb844b498e1b5976aca4563.tar.bz2
drakwizard-9842dab5de4a22772bb844b498e1b5976aca4563.tar.xz
drakwizard-9842dab5de4a22772bb844b498e1b5976aca4563.zip
add an antislash to special char like \q, \a, etc...
-rw-r--r--wpo2po.pl52
1 files changed, 30 insertions, 22 deletions
diff --git a/wpo2po.pl b/wpo2po.pl
index ed84b8d3..a41c9d0e 100644
--- a/wpo2po.pl
+++ b/wpo2po.pl
@@ -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";