summaryrefslogtreecommitdiffstats
path: root/perl-install/lang.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2010-06-05 10:52:32 +0000
committerThierry Vignaud <tv@mandriva.org>2010-06-05 10:52:32 +0000
commit901660090890305fd1db8e3dddc22d41ef153b04 (patch)
treeb680d959eeacae8154f413af9da8df4639d3fd36 /perl-install/lang.pm
parent2f93b20d1886a6f233ccc2d91cef11db63ab4908 (diff)
downloaddrakx-901660090890305fd1db8e3dddc22d41ef153b04.tar
drakx-901660090890305fd1db8e3dddc22d41ef153b04.tar.gz
drakx-901660090890305fd1db8e3dddc22d41ef153b04.tar.bz2
drakx-901660090890305fd1db8e3dddc22d41ef153b04.tar.xz
drakx-901660090890305fd1db8e3dddc22d41ef153b04.zip
(is_locale_installed,list_langs) fix listing locales only providing
UTF8 metadata (#59634, Herton Ronaldo Krzesinski, further cleaned by me)
Diffstat (limited to 'perl-install/lang.pm')
-rw-r--r--perl-install/lang.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index df95cf1ac..fd1ea3cec 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -182,10 +182,18 @@ sub l2location {
}
sub l2charset { exists $langs{$_[0]} && $langs{$_[0]}[4] }
sub l2language { exists $langs{$_[0]} && $langs{$_[0]}[5] }
+
+sub is_locale_installed {
+ my ($locale) = @_;
+ my @ctypes = glob "/usr/share/locale/" . l2locale($locale) . "{,.*}/LC_CTYPE";
+ foreach my $ctype (@ctypes) { -e $ctype && return 1 }
+ 0;
+}
+
sub list_langs {
my (%options) = @_;
my @l = keys %langs;
- $options{exclude_non_installed} ? grep { -e "/usr/share/locale/" . l2locale($_) . "/LC_CTYPE" } @l : @l;
+ $options{exclude_non_installed} ? grep { is_locale_installed($_) } @l : @l;
}
sub text_direction_rtl() {