diff options
Diffstat (limited to 'perl-install/standalone')
-rw-r--r-- | perl-install/standalone/drakhelp | 8 | ||||
-rwxr-xr-x | perl-install/standalone/drakxtv | 43 | ||||
-rw-r--r-- | perl-install/standalone/localedrake | 31 |
3 files changed, 43 insertions, 39 deletions
diff --git a/perl-install/standalone/drakhelp b/perl-install/standalone/drakhelp index a6da9f497..a3a0a9653 100644 --- a/perl-install/standalone/drakhelp +++ b/perl-install/standalone/drakhelp @@ -15,11 +15,11 @@ die "Usage: drakhelp <help_path>" if @ARGV != 1; my $in = interactive->vnew; -my $lang = lang::lang2LANG(lang::read('',$>)) || 'en'; -if (!member($lang, qw(de en es fr it ru))) { $lang = 'en' }; -my $path_to_help = "/usr/share/doc/mandrake/" . $lang . "/"; +my $locale = lang::read('', $>); +if (!member($locale->{lang}, qw(de en es fr it ru))) { $locale->{lang} = 'en' }; +my $path_to_help = "/usr/share/doc/mandrake/" . $locale->{lang} . "/"; --d $path_to_help or $in->do_pkgs->install('mandrake_doc-drakxtools-' . $lang); +-d $path_to_help or $in->do_pkgs->install('mandrake_doc-drakxtools-' . $locale->{lang}); if ((my $wm = any::running_window_manager()) eq 'kwin') { system("mdklaunchhelp " . $path_to_help . $ARGV[0] . "&"); diff --git a/perl-install/standalone/drakxtv b/perl-install/standalone/drakxtv index d373b6e05..515af17a9 100755 --- a/perl-install/standalone/drakxtv +++ b/perl-install/standalone/drakxtv @@ -71,33 +71,32 @@ You can install it by typing \"urpmi xawtv\" as root, in a console."))); ); # Info: HRC means "Harmonically Related Carrier" - # default to pal since most people use that - $norm = "PAL"; my %countries = ( - "ar" => [ "argentina" ], - "au" => [ "australia" ], - "(br|fr)" => ["france", "SECAM"], - "ca" => [ "canada-cable" ], - "(ga|ie)" => [ "ireland" ], - "it" => [ "italy" ], - "jp" => [ "japan-bcast", "NTSC-JP" ], - "nz" => [ "newzealand" ], - "(at|be|ch|de|eu|gb|se)" => [ "europe-west" ], - "us" => [ "us-bcast", "NTSC" ], - "za" => [ "southafrica" ], - "(zh|TW|Big5|CN.GB2312|CN)" => [ "china-bcast" ] + "AR" => [ "argentina" ], + "AU" => [ "australia" ], + "FR" => [ "france", "SECAM"], + "CA" => [ "canada-cable" ], + "IE" => [ "ireland" ], + "IT" => [ "italy" ], + "JP" => [ "japan-bcast", "NTSC-JP" ], + "NZ" => [ "newzealand" ], + "AT|BE|CH|DE|ES|GB|SE" => [ "europe-west" ], + "US" => [ "us-bcast", "NTSC" ], + "ZA" => [ "southafrica" ], + "CN|TW" => [ "china-bcast" ] ); - ($_) = lang::read('', $>); - foreach my $i (keys %countries) { - if (/($i|$i.UTF-8)$/i) { - my $tbl = $countries{$i}; - $ftable_id = $tbl->[0]; - $norm = $tbl->[1] if $tbl->[1]; - } + my $tbl; + my $locale = lang::read('', $>); + $locale->{country} =~ /$_/ and $tbl = $countries{$_} foreach keys %countries; + if ($tbl) { + $ftable_id = $tbl->[0]; + $norm = $tbl->[1] if $tbl->[1]; } - log::l("[drakxtv] guess lang=>$_, norm=>$norm, area=>$ftable_id"); + # default to pal since most people use that + $norm ||= "PAL"; + log::l("[drakxtv] guess country=>$locale->{country}, norm=>$norm, area=>$ftable_id"); if ($in->ask_from("TVdrake", N("Please,\ntype in your tv norm and country"), [ diff --git a/perl-install/standalone/localedrake b/perl-install/standalone/localedrake index 13b18027b..66bcc05bf 100644 --- a/perl-install/standalone/localedrake +++ b/perl-install/standalone/localedrake @@ -14,28 +14,33 @@ my ($klang, $country, $apply); foreach (@ARGV) { $apply = /--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; + 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('', $locale, $>, 'dont_touch_kde_files') if $apply; #- help KDE defaulting to the right charset - print lang::charset2kde_charset(lang::lang2charset($lang)), "\n"; + print lang::charset2kde_charset(lang::l2charset($lang)), "\n"; } else { - my ($lang) = lang::read('', $>); - + my $locale = 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); - } + 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); } } +the_end: $in->exit(0); } |