summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Desmons <adesmons@mandriva.com>2002-08-09 08:42:15 +0000
committerArnaud Desmons <adesmons@mandriva.com>2002-08-09 08:42:15 +0000
commit635af4aa84bc88a6cc20e26c5084c188217848ef (patch)
tree31150befb863962f067baece898e04246bfd9cee
parent15bb8f0ef337da55d96f8ae0884565759d6f76d5 (diff)
downloaddrakwizard-635af4aa84bc88a6cc20e26c5084c188217848ef.tar
drakwizard-635af4aa84bc88a6cc20e26c5084c188217848ef.tar.gz
drakwizard-635af4aa84bc88a6cc20e26c5084c188217848ef.tar.bz2
drakwizard-635af4aa84bc88a6cc20e26c5084c188217848ef.tar.xz
drakwizard-635af4aa84bc88a6cc20e26c5084c188217848ef.zip
po support
-rw-r--r--Makefile2
-rwxr-xr-xdrakwizard.pl43
2 files changed, 35 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 610f41b7..703061dc 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@ rpm:
cp -rf client_wizard drakwizard-$(VERSION)
cp -rf db_wizard drakwizard-$(VERSION)
cp -rf proxy_wizard drakwizard-$(VERSION)
+ cp -rf po drakwizard-$(VERSION)
cp -f Wizard.dtd Makefile drakwizard.pl drakwizard.spec drakwizard-$(VERSION)
rm -f drakwizard-$(VERSION).tar.bz2
rm -f drakwizard-$(VERSION).tar
@@ -53,6 +54,7 @@ install:
cd client_wizard; make prefix=${prefix} install
cd db_wizard; make prefix=${prefix} install
cd proxy_wizard; make prefix=${prefix} install
+ cd po; make prefix=${prefix} install
clean_test:
rm -rf test
diff --git a/drakwizard.pl b/drakwizard.pl
index 3ce68898..da42865d 100755
--- a/drakwizard.pl
+++ b/drakwizard.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Wizdrake
+# Drakwizard
# Copyright (C) 2002 MandrakeSoft Mael Dodin (mdodin@mandrakesoft.com)
#
@@ -20,7 +20,7 @@
use lib qw(/usr/lib/libDrakX);
#use strict;
-use vars qw($wizard_title $lib_script $perl_module %variable $in $welcome $rpm $bifield $chooser_hash);
+use vars qw($wizard_title $lib_script $perl_module %variable $in $rpm $bifield $chooser_hash $wpo);
use XML::Parser;
use standalone;
@@ -28,10 +28,22 @@ use interactive;
use MDK::Common::Func;
use common;
-defined($ARGV[0]) or die "Usage: drakwizard *.wiz\n";
-my $in = 'interactive'->vnew('su', 'default');
+use POSIX;
+use Locale::gettext();
+
+#- I18N.
+setlocale (LC_ALL, "");
+Locale::gettext::textdomain ("drakwizard");
+
+sub translate {
+ my ($format, @params) = @_;
+
+ !$format and return;
+ sprintf(Locale::gettext::gettext($format), @params);
+}
-sub translate { $_[0] }
+defined($ARGV[0]) or die "Usage: drakwizard /usr/share/wizards/*/*.wiz\n";
+my $in = 'interactive'->vnew('su', 'default');
sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 }
@@ -63,18 +75,28 @@ sub get_parameter {
$ENV{$leaf->{shellVariable}} = $leaf->{defaultValue};
},
Page => sub {
- $welcome ||= $page;
my $old_page = $page;
push @$o, $page = { %$leaf };
$old_page->{next_page} = $page;
if ($leaf->{canBack} =~ /.*false.*/) { $page->{no_prev} = 1}
if ($leaf->{canCancel} =~ /.*false.*/) { $page->{no_cancel} = 1}
+ if ($leaf->{nextFinish} =~ /.*true.*/) { $page->{finish} = 1}
},
Target => sub {
$page->{Target}->{jumpIndex}->{$leaf->{jumpIndex}} = $leaf->{targetName};
},
Info => sub {
+ # This is to avoid monospaced text to be interpolated
+ $leaf->{helpText} = translate($leaf->{helpText});
+ if ($leaf->{fontName} eq "Monospaced") {
+ chomp($leaf->{helpText});
+ $leaf->{helpText} = "\n".$leaf->{helpText};
+ }
$page->{info} = $leaf->{helpText} ? "$page->{info} $leaf->{helpText}" : "$page->{info}\n";
+ if ($leaf->{fillScript}) {
+ $page->{info} .= `source $lib_script; $leaf->{fillScript}`;
+ }
+ # XML compatibility
$page->{info} =~ s/\\\'/\'/g;
$page->{info} =~ s/\\q/\"/g;
$page->{info} =~ s/\\a/\&/g;
@@ -113,6 +135,9 @@ sub display {
if ($page->{no_prev} || $page->{no_cancel}) {
$::Wizard_no_previous = 1;
}
+ if ($page->{finish}) {
+ $::Wizard_finished = 1;
+ }
if ($page->{nextFinish} eq 'true') {
$::Wizard_no_previous = 1;
$in->ask_okcancel(translate($page->{name}),
@@ -128,9 +153,6 @@ sub display {
my @liste;
my $chooser_var;
my @data = map {
-# for ($_->{fillScript}) {
-# system("source $lib_script ; $_->{fillScript}");
-# }
if ($_->{main_order} eq 'combo') {
if($_->{fillScript}){
$valeur = `$_->{fillScript}`;
@@ -153,6 +175,7 @@ sub display {
: { label => translate($_->{helpText}), val => \$ENV{$variable{$_->{variableName}}},
list => [@liste, ""], type => $_->{main_order} };
} @{$page->{freetext}};
+
if($page->{executionLevel} eq 'NORMAL'){
$in->ask_from(translate($page->{name}), translate($page->{info}),
\@data) or navigation($o, $page->{old_page});
@@ -214,7 +237,7 @@ sub navigation {
}
my $o = [];
-my $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
+$xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]);
get_parameter($o, $xmltree);