diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-14 09:12:31 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-14 09:12:31 +0000 |
commit | 7a54a173e88eb823979770b188aa4806b80d6612 (patch) | |
tree | 31cfc2d6ce25358c322f27e3718459b793140865 /wiz2pot.pl | |
parent | 8d3363e458e28caa5619048c6ba56203f66f5f70 (diff) | |
download | drakwizard-7a54a173e88eb823979770b188aa4806b80d6612.tar drakwizard-7a54a173e88eb823979770b188aa4806b80d6612.tar.gz drakwizard-7a54a173e88eb823979770b188aa4806b80d6612.tar.bz2 drakwizard-7a54a173e88eb823979770b188aa4806b80d6612.tar.xz drakwizard-7a54a173e88eb823979770b188aa4806b80d6612.zip |
wiz2pot :-)
Diffstat (limited to 'wiz2pot.pl')
-rwxr-xr-x | wiz2pot.pl | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/wiz2pot.pl b/wiz2pot.pl new file mode 100755 index 00000000..14a51b51 --- /dev/null +++ b/wiz2pot.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use strict; +use XML::Parser; + + +sub load_wpo { + my ($tree, $tag ,$page) = @_; + + foreach my $leaf (@$tree) { + if (ref($leaf) eq 'ARRAY') { + $page = load_wpo($leaf, $tag, $page); + } elsif (ref($leaf) eq 'HASH') { + # XML compatibility + $leaf->{helpText} =~ s/\\'/\\\\'/g; + $leaf->{helpText} =~ s/\\q/\\\\q/g; + $leaf->{helpText} =~ s/\\a/\\\\a/g; + $page->{$leaf->{helpText}} = ""; + }elsif(ref($leaf)=~ /\w\D/){ + $tag = $leaf; + } + } + $page; +} + +my $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]); +my $wpo = load_wpo($xmltree); + +print STDERR "$ARGV[0] =>"; +$ARGV[0] =~ /.*\/(.*)\.wiz.*/; + +open(PO, "> ./po/$1.pot"); +my $date = `date +%Y-%m-%d\\ %H:%M\\ %z`; +chomp $date; + +foreach (keys %{$wpo}) { + if ($_ ne "") { + if ($_ eq $wpo->{$_}) { + print PO "msgid \"$_\"\nmsgstr \"\"\n\n"; + } + else { + print PO "msgid \"$_\"\nmsgstr \"$wpo->{$_}\"\n\n"; + } + } + +} +close PO; +print STDERR "./po/$1.pot\n"; |