diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-14 12:25:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-14 12:25:00 +0000 |
commit | 891947e23e895cf6fdd465e2c7a36c885a0bf73e (patch) | |
tree | 46da3062212a9becbc0f4709f462db50ea81e821 /perl-install/lang.pm | |
parent | 8fd384c7c95a38f252fb10b93effb7b8399d8c54 (diff) | |
download | drakx-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/lang.pm')
-rw-r--r-- | perl-install/lang.pm | 32 |
1 files changed, 22 insertions, 10 deletions
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; } #------------------------------------------------------------- |