diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-05-11 23:18:21 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-05-11 23:18:21 +0000 |
commit | fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4 (patch) | |
tree | 498491d25a0290e232f236927a37dccdc233ac27 | |
parent | 76fdde3ca84a2cb6ce204e973f2386ac0738957b (diff) | |
download | drakx-fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4.tar drakx-fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4.tar.gz drakx-fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4.tar.bz2 drakx-fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4.tar.xz drakx-fcf8e1b52fcf5e81c5548e0b77df71f4d95430e4.zip |
use lang::analyse_locale_name() and lang::analyse_locale_name()
-rw-r--r-- | perl-install/any.pm | 7 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 3 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/keyboard.pm | 10 | ||||
-rw-r--r-- | perl-install/printer/main.pm | 3 |
5 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index 5eff5c9b2..4abda68be 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -685,8 +685,11 @@ sub selectCountry { my $country = $locale->{country}; my @countries = lang::list_countries(exclude_non_installed => !$::isInstall); - my @best = uniq map { if_((/^\Q$locale->{lang}/ || substr($_, 0, 2) eq substr($locale->{lang}, 0, 2)) - && /.._(..)/, $1) } @lang::locales; + my @best = uniq grep { + my $h = lang::analyse_locale_name($_); + if_($h->{main} eq lang::locale_to_main_locale($locale->{lang}) && $h->{country}, + $h->{country}); + } @lang::locales; @best == 1 and @best = (); my ($other, $ext_country); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 2c779e9b4..658dfc6f5 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -104,7 +104,8 @@ sub selectLanguage { $o->{locale}{langs} ||= { $o->{locale}{lang} => 1 }; if (!exists $o->{locale}{country}) { - $o->{locale}{country} = $1 if lang::l2locale($o->{locale}{lang}) =~ /^.._(..)/; + my $h = lang::analyse_locale_name($o->{locale}{lang}); + $o->{locale}{country} = $h->{country} if $h->{country}; } lang::set($o->{locale}, !$o->isa('interactive::gtk')); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 896d60641..a0c9c9083 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -897,7 +897,7 @@ sub summary { clicked => sub { any::selectCountry($o, $o->{locale}) or return; - my $pkg_locale = substr(lang::getlocale_for_country($o->{locale}{lang}, $o->{locale}{country}), 0, 2); + my $pkg_locale = locale_to_main_locale(lang::getlocale_for_country($o->{locale}{lang}, $o->{locale}{country})); my @pkgs = pkgs::packagesProviding($o->{packages}, "locales-$pkg_locale"); $o->pkg_install(map { $_->name } @pkgs) if @pkgs; diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index 7f3d90edd..a851ab9c8 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -9,6 +9,7 @@ use strict; use common; use detect_devices; use run_program; +use lang; use log; use c; @@ -364,9 +365,11 @@ sub unpack_keyboards { } sub lang2keyboards { my @li = sort { $b->[1] <=> $a->[1] } map { @$_ } map { - #- first try with the 5 first chars of LANG; if it fails then try with - #- with the 2 first chars of LANG before resorting to default. - unpack_keyboards($lang2keyboard{substr($_, 0, 5)}) || unpack_keyboards($lang2keyboard{substr($_, 0, 2)}) || [ [ ($keyboards{$_} ? $_ : "us") => 100 ] ]; + my $h = lang::analyse_locale_name($_); + #- example: pt_BR and pt + my @l = if_($h->{country}, $h->{main} . '_' . $h->{country}), $h->{main}; + my $k = find { $_ } map { $lang2keyboard{$_} } @l; + unpack_keyboards($k) || [ [ ($keyboards{$_} ? $_ : "us") => 100 ] ]; } @_; \@li; } @@ -525,7 +528,6 @@ sub read() { } sub check() { - require lang; $^W = 0; my $not_ok = 0; diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index d9f06ddde..fdfbdf317 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -15,6 +15,7 @@ use printer::office; use printer::detect; use handle_configs; use services; +use lang; use vars qw(@ISA @EXPORT); @@ -1534,7 +1535,7 @@ sub ppd_entry_str { if $mf && $mf !~ m![\\/\(\)\[\]\|\.\$\@\%\*\?]!; # Put out the resulting description string uc($mf) . '|' . $model . '|' . $driver . - ($lang && " (" . lc(substr($lang, 0, 2)) . ")"); + ($lang && " (" . lang::locale_to_main_locale($lang) . ")"); } sub get_descr_from_ppd { |