summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-01-14 12:25:00 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-01-14 12:25:00 +0000
commit891947e23e895cf6fdd465e2c7a36c885a0bf73e (patch)
tree46da3062212a9becbc0f4709f462db50ea81e821 /perl-install
parent8fd384c7c95a38f252fb10b93effb7b8399d8c54 (diff)
downloaddrakx-891947e23e895cf6fdd465e2c7a36c885a0bf73e.tar
drakx-891947e23e895cf6fdd465e2c7a36c885a0bf73e.tar.gz
drakx-891947e23e895cf6fdd465e2c7a36c885a0bf73e.tar.bz2
drakx-891947e23e895cf6fdd465e2c7a36c885a0bf73e.tar.xz
drakx-891947e23e895cf6fdd465e2c7a36c885a0bf73e.zip
- localedrake, drakx-finish-install:
o fix proposing Belgium when lang is "nl" and locales-fr is not installed (same for Canada with lang "fr" and locales-en not installed) (#36413) nb: - removed restricting countries to installed locales in list_countries(), since c2locale is wrong for countries like CA or BE which have more than one lang - country_to_locales() is replaced with countries_to_locales() to avoid redoing the same computation all the time
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS4
-rw-r--r--perl-install/any.pm7
-rw-r--r--perl-install/lang.pm32
3 files changed, 30 insertions, 13 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 488257d7f..7828b493a 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,7 @@
+- localedrake, drakx-finish-install:
+ o fix proposing Belgium when lang is "nl" and locales-fr is not installed
+ (same for Canada with lang "fr" and locales-en not installed) (#36413)
+
Version 10.6.3 - 9 January 2008, by Thierry Vignaud
- handle new drivers: atl2 (ethernet), snd-virtuoso
diff --git a/perl-install/any.pm b/perl-install/any.pm
index fa8d3c158..b0da2a94a 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -1034,11 +1034,12 @@ sub selectCountry {
my ($in, $locale) = @_;
my $country = $locale->{country};
- my @countries = lang::list_countries(exclude_non_installed => !$::isInstall);
+ my $country2locales = lang::countries_to_locales(exclude_non_installed => !$::isInstall);
+ my @countries = keys %$country2locales;
my @best = grep {
find {
- lang::locale_to_main_locale($_) eq lang::locale_to_main_locale($locale->{lang});
- } lang::country_to_locales($_);
+ $_->{main} eq lang::locale_to_main_locale($locale->{lang});
+ } @{$country2locales->{$_}};
} @countries;
@best == 1 and @best = ();
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index e4c39314f..a8bbd0404 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -449,9 +449,8 @@ my %countries = (
sub c2name { exists $countries{$_[0]} && translate($countries{$_[0]}[0]) }
sub c2locale { exists $countries{$_[0]} && $countries{$_[0]}[1] }
sub list_countries {
- my (%options) = @_;
- my @l = keys %countries;
- $options{exclude_non_installed} ? grep { -e "/usr/share/locale/" . c2locale($_) . "/LC_CTYPE" } @l : @l;
+ my (%_options) = @_;
+ keys %countries;
}
#- this list is built with the following command on the compile cluster:
@@ -520,15 +519,28 @@ sub getLANGUAGE {
locale_to_main_locale($lang)));
}
-sub country_to_locales {
- my ($country) = @_;
+sub countries_to_locales {
+ my (%options) = @_;
- my $lang = c2locale($country) or return;
+ my %country2locales;
+ my $may_add = sub {
+ my ($locale, $country) = @_;
+ if ($options{exclude_non_installed}) {
+ -e "/usr/share/locale/$locale/LC_CTYPE" or return;
+ }
+ my $h = analyse_locale_name($locale) or internal_error();
+ push @{$country2locales{$country || $h->{country}}}, $h;
+ };
- uniq($lang, grep {
- my $h = analyse_locale_name($_) or internal_error();
- $h->{country} eq $country;
- } @locales);
+ # first add all real locales
+ foreach (@locales) {
+ $may_add->($_, undef);
+ }
+ # then add countries XX for which we use locale yy_ZZ and not yy_XX
+ foreach my $country (list_countries()) {
+ $may_add->(c2locale($country), $country);
+ }
+ \%country2locales;
}
#-------------------------------------------------------------