diff options
Diffstat (limited to 'perl-install/standalone/localedrake')
| -rwxr-xr-x[-rw-r--r--] | perl-install/standalone/localedrake | 58 |
1 files changed, 37 insertions, 21 deletions
diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake index 2d2d9ac83..231c528ea 100644..100755 --- a/perl-install/standalone/localedrake +++ b/perl-install/standalone/localedrake @@ -5,37 +5,53 @@ use lib qw(/usr/lib/libDrakX); use standalone; #- warning, standalone must be loaded very first, for 'explanations' use interactive; +use common; use lang; use any; -my ($klang, $country, $apply); +my ($klang, $kcountry, $apply); foreach (@ARGV) { - $apply = /--apply/; + $apply = 1 if /--apply/; $klang = $1 if /--kde_lang=(.*)/; - $country = $1 if /--kde_country=(.*)/; + $kcountry = uc($1) if /--kde_country=(.*)/; } + if (defined $klang) { - $klang or exit; - my $lang = lang::kde_lang_country2lang($klang, $country); - lang::write('', $lang, $>, 'dont_touch_kde_files') if $apply; + $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($>); + $klang and $locale->{lang} = $lang; + $kcountry and $locale->{country} = $country; + lang::write_and_install($locale, do_pkgs_standalone->new, $>, 'dont_touch_kde_files') if $apply; #- help KDE defaulting to the right charset - print lang::charset2kde_charset(lang::lang2charset($lang)), "\n"; -} else { - my ($lang) = lang::read('', $>); - - my $in = 'interactive'->vnew; - if ($lang = any::selectLanguage($in, $lang)) { - lang::write('', $lang, $>); - if ($>) { - if (my $wm = any::running_window_manager()) { - $in->ask_okcancel('', N("The change is done, but to be effective you must logout"), 1) - && any::ask_window_manager_to_logout($wm); - } - } - } - $in->exit(0); + print lang::charset2kde_charset(lang::l2charset($lang)), "\n"; + exit(0); } +my $locale = lang::read($>); +my $in = 'interactive'->vnew; + +$ugtk3::wm_icon = "localedrake"; +$::Wizard_title = N("LocaleDrake"); + +any::selectLanguage_and_more_standalone($in, $locale); + +if ($>) { + my @required_packages = lang::IM2packages($locale); + my @missing_packages = difference2(\@required_packages, [ $in->do_pkgs->are_installed(@required_packages) ]); + $in->ask_warn(N("Warning"), + N("You should install the following packages: %s", + join( + #-PO: the following is used to combine packages names. eg: "initscripts, harddrake, yudit" + N(", "), + @missing_packages, + ), + ) + ) if @missing_packages; +} +lang::write_and_install($locale, $in->do_pkgs, $>); +any::ask_for_X_restart($in); |
