summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-08-29 17:31:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-08-29 17:31:16 +0000
commit909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7 (patch)
treea663c431f0076f3c03c555663ea8a5f326b367fe
parent17675cf6acfe4d3b9e092284484371dc3bdcc7e1 (diff)
downloaddrakx-909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7.tar
drakx-909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7.tar.gz
drakx-909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7.tar.bz2
drakx-909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7.tar.xz
drakx-909cfffcd84cb05d8b4c5ab5057bbdcfb230fee7.zip
add localedrake (not tested)
-rw-r--r--perl-install/Makefile.config2
-rw-r--r--perl-install/any.pm21
-rw-r--r--perl-install/install_steps_interactive.pm18
-rw-r--r--perl-install/lang.pm16
-rw-r--r--perl-install/standalone/localedrake17
5 files changed, 56 insertions, 18 deletions
diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config
index 48d379551..31609029d 100644
--- a/perl-install/Makefile.config
+++ b/perl-install/Makefile.config
@@ -5,7 +5,7 @@ VERSION = 2.2.10-BOOT
SUDO = sudo
SO_FILES = c/blib/arch/auto/c/c.so
PMS = *.pm Newt/*.pm c/stuff.pm resize_fat/*.pm sbus_probing/*.pm network/*.pm commands install2 g_auto_install live_install live_install2
-STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake
+STANDALONEPMS= diskdrake XFdrake mousedrake printerdrake keyboarddrake draknet localedrake net_monitor drakbug_report tinyfirewall drakxconf drakxservices draksec drakboot adduserdrake drakgw drakautoinst livedrake
PMS += $(STANDALONEPMS:%=standalone/%)
REP4PMS = /usr/bin/perl-install
ROOTDEST = /export
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 2696017d2..4889dff70 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -12,6 +12,7 @@ use detect_devices;
use partition_table qw(:types);
use fsedit;
use fs;
+use lang;
use run_program;
use modules;
use log;
@@ -769,6 +770,26 @@ Do you want to use this feature?'),
}
}
+sub selectLanguage {
+ my ($in, $lang, $langs) = @_;
+ $in->ask_from_(
+ { messages => _("Please, choose a language to use."),
+ advanced_messages => _("You can choose other languages that will be available after install"),
+ callbacks => {
+ focus_out => sub { $langs->{$lang} = 1 },
+ },
+ },
+ [ { val => \$lang, separator => '|',
+ format => \&lang::lang2text, list => [ lang::list() ] },
+ (map {;
+ { val => \$langs->{$_->[0]}, type => 'bool', disabled => sub { $langs->{all} },
+ text => $_->[1], advanced => 1,
+ }
+ } sort { $a->[1] cmp $b->[1] } map { [ $_, lang::lang2text($_) ] } lang::list()),
+ { val => \$langs->{all}, type => 'bool', text => _("All"), advanced => 1 }
+ ]) and $lang;
+}
+
sub write_passwd_user {
my ($prefix, $u, $isMD5) = @_;
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 3954d9ad1..d62643298 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -51,23 +51,7 @@ sub charsetChanged {}
sub selectLanguage {
my ($o) = @_;
- $o->ask_from_(
- { messages => _("Please, choose a language to use."),
- advanced_messages => _("You can choose other languages that will be available after install"),
- callbacks => {
- focus_out => sub { $o->{langs}{$o->{lang}} = 1 },
- },
- },
- [ { val => \$o->{lang}, separator => '|',
- format => \&lang::lang2text, list => [ lang::list() ] },
- (map {;
- { val => \$o->{langs}{$_->[0]}, type => 'bool', disabled => sub { $o->{langs}{all} },
- text => $_->[1], advanced => 1,
- }
- } sort { $a->[1] cmp $b->[1] } map { [ $_, lang::lang2text($_) ] } lang::list()),
- { val => \$o->{langs}{all}, type => 'bool', text => _("All"), advanced => 1 }
- ]);
-
+ any::selectLanguage($o, $o->{lang}, $o->{langs} ||= {});
install_steps::selectLanguage($o);
$o->charsetChanged;
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index c098eb8a1..e6fbb3596 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -369,6 +369,22 @@ sub pack_langs {
$s;
}
+sub unpack_langs {
+ my ($s) = @_;
+ my @l = uniq(map { split ':', $languages{$_}[3] } split(':', $s));
+ my @l2 = intersection(\@l, [ keys %languages ]);
+ +{ map { $_ => 1 } @l2 };
+}
+
+sub read {
+ my ($prefix) = @_;
+ my $h = getVarsFromSh("$prefix/etc/sysconfig/i18n");
+ my $lang = $h ? $h->{LC_MESSAGES} : 'en_US';
+ my $langs =
+ cat_("$prefix/etc/rpm/macros") =~ /%_install_langs (.*)/ ? unpack_langs($1) : { $lang => 1 };
+ $lang, $langs;
+}
+
sub write_langs {
my ($prefix, $langs) = @_;
my $s = pack_langs($langs);
diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake
new file mode 100644
index 000000000..cc9b68260
--- /dev/null
+++ b/perl-install/standalone/localedrake
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+use lib qw(/usr/lib/libDrakX);
+
+use interactive;
+use lang;
+use any;
+
+my $in = 'interactive'->vnew('su');
+
+my ($lang, $langs) = lang::read();
+if ($lang = any::selectLanguage($in, $lang, $langs)) {
+ lang::write('', $lang);
+ lang::write_langs('', $langs);
+}
+
+$in->exit(0);