diff options
-rw-r--r-- | perl-install/NEWS | 4 | ||||
-rw-r--r-- | perl-install/any.pm | 7 | ||||
-rw-r--r-- | perl-install/lang.pm | 32 |
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; } #------------------------------------------------------------- |