summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/localedrake
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-03-05 17:53:47 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-03-05 17:53:47 +0000
commit2dbbcd2144d8c53d7223a0dd709b80f90a6dde25 (patch)
tree7793ef43dbb2ad985ca0884f9f72bb7653bd3bbb /perl-install/standalone/localedrake
parent982c13b4bc6a3d34d09dc2e10a75e2f0651068f4 (diff)
downloaddrakx-2dbbcd2144d8c53d7223a0dd709b80f90a6dde25.tar
drakx-2dbbcd2144d8c53d7223a0dd709b80f90a6dde25.tar.gz
drakx-2dbbcd2144d8c53d7223a0dd709b80f90a6dde25.tar.bz2
drakx-2dbbcd2144d8c53d7223a0dd709b80f90a6dde25.tar.xz
drakx-2dbbcd2144d8c53d7223a0dd709b80f90a6dde25.zip
fix behaviour when only one lang is available (clicking
on "cancel" on the country selection didn't cancel it)
Diffstat (limited to 'perl-install/standalone/localedrake')
-rw-r--r--perl-install/standalone/localedrake54
1 files changed, 38 insertions, 16 deletions
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);
+