From 2dbbcd2144d8c53d7223a0dd709b80f90a6dde25 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 5 Mar 2003 17:53:47 +0000 Subject: fix behaviour when only one lang is available (clicking on "cancel" on the country selection didn't cancel it) --- perl-install/any.pm | 1 + perl-install/drakxtools.spec | 4 ++- perl-install/standalone/localedrake | 54 ++++++++++++++++++++++++++----------- 3 files changed, 42 insertions(+), 17 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index c42583384..ad55cfde4 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -668,6 +668,7 @@ when your installation is complete and you restart your system.")), } else { my @langs = sort { lang::l2name($a) cmp lang::l2name($b) } lang::list_langs(exclude_non_installed => 1); + die 'one lang only' if @langs == 1; $in->ask_from_($common, [ { val => \$lang, type => 'list', format => sub { lang::l2name($_[0]) }, list => \@langs } ]) or return; diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec index 90772db1a..35b0307fb 100644 --- a/perl-install/drakxtools.spec +++ b/perl-install/drakxtools.spec @@ -291,7 +291,9 @@ file /etc/sysconfig/harddrake2/previous_hw | fgrep -q perl && %_datadir/harddrak %config(noreplace) %_sysconfdir/logrotate.d/drakxtools-http %changelog -* Tue Mar 4 2003 Thierry Vignaud 9.1-14mdk +* Wed Mar 5 2003 Guillaume Cottenceau 9.1-14mdk +- localedrake: fix behaviour when only one lang is available (clicking + on "cancel" on the country selection didn't cancel it) - drakconnect: fixes in isdn configuration (flepied) - drakperm: o fix #1776 diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake index 66bcc05bf..4f5a433e3 100644 --- a/perl-install/standalone/localedrake +++ b/perl-install/standalone/localedrake @@ -9,15 +9,16 @@ use common; use lang; use any; -my ($klang, $country, $apply); +my ($klang, $kcountry, $apply); foreach (@ARGV) { $apply = /--apply/; $klang = $1 if /--kde_lang=(.*)/; $kcountry = uc($1) if /--kde_country=(.*)/; } + if (defined $klang) { - $klang or exit; + $klang or exit(-1); my $lang = member($klang, lang::list_langs()) ? $klang : 'en_US'; my $country = member($kcountry, lang::list_countries()) ? $kcountry : 'US'; my $locale = lang::read('', $>); @@ -27,21 +28,42 @@ if (defined $klang) { #- help KDE defaulting to the right charset print lang::charset2kde_charset(lang::l2charset($lang)), "\n"; -} else { - my $locale = lang::read('', $>); - my $in = 'interactive'->vnew; - select_language: - $locale->{lang} = any::selectLanguage($in, $locale->{lang}) or goto the_end; - any::selectCountry($in, $locale) or goto select_language; - lang::write('', $locale, $>); - if ($>) { - if (my $wm = any::running_window_manager()) { - $in->ask_okcancel('', N("The change is done, but to be effective you must logout"), 1) - and any::ask_window_manager_to_logout($wm); - } + exit(0); +} + +my $locale = lang::read('', $>); +my $in = 'interactive'->vnew; +my $one_lang_only; + +sub select_language { + $locale->{lang} = any::selectLanguage($in, $locale->{lang}); +} +sub select_country { + any::selectCountry($in, $locale); +} + +eval { + language: + select_language() or goto the_end; + select_country() or goto language; +}; +if ($@) { + if ($@ =~ /^one lang only/) { + select_country() or goto the_end; + } else { + die; } -the_end: - $in->exit(0); } +lang::write('', $locale, $>); +if ($>) { + if (my $wm = any::running_window_manager()) { + $in->ask_okcancel('', N("The change is done, but to be effective you must logout"), 1) + and any::ask_window_manager_to_logout($wm); + } +} + +the_end: +$in->exit(0); + -- cgit v1.2.1