summaryrefslogtreecommitdiffstats
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
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)
-rw-r--r--perl-install/NEWS4
-rw-r--r--perl-install/lang.pm10
2 files changed, 13 insertions, 1 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 30232777c..4ceaaaba6 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,7 @@
+- localedrake:
+ o fix listing locales only providing UTF8 metadata (#59634, Herton
+ Ronaldo Krzesinski)
+
Version 13.33 - 4 June 2010
- lookup major:minor of devices outside $::prefix
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() {