summaryrefslogtreecommitdiffstats
path: root/perl-install/lang.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-01-07 13:22:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-01-07 13:22:28 +0000
commitc2f200920f04dba0874c054038770a91a71fbba5 (patch)
tree7448485cea94afcd511535b592b1f061c543f3b9 /perl-install/lang.pm
parent0a813b0ea3c7c30ca81e79b6303f5141e95fee4b (diff)
downloaddrakx-c2f200920f04dba0874c054038770a91a71fbba5.tar
drakx-c2f200920f04dba0874c054038770a91a71fbba5.tar.gz
drakx-c2f200920f04dba0874c054038770a91a71fbba5.tar.bz2
drakx-c2f200920f04dba0874c054038770a91a71fbba5.tar.xz
drakx-c2f200920f04dba0874c054038770a91a71fbba5.zip
use "if any" instead of "if grep", and various other occurences of "any", "every", "partition"
Diffstat (limited to 'perl-install/lang.pm')
-rw-r--r--perl-install/lang.pm18
1 files changed, 9 insertions, 9 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index d3ced6c9e..bdacc81e1 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -428,7 +428,7 @@ sub lang2country {
$country ||= $valid_country->(lc($1)) if $lang =~ /([A-Z]+)/;
$country ||= $valid_country->(lc($1)) if lang2LANGUAGE($lang) =~ /([A-Z]+)/;
$country ||= $valid_country->(substr($lang, 0, 2));
- $country ||= first(grep { $valid_country->($_) } map { substr($_, 0, 2) } split(':', lang2LANGUAGE($lang)));
+ $country ||= find { $valid_country->($_) } map { substr($_, 0, 2) } split(':', lang2LANGUAGE($lang));
$country || 'C';
}
@@ -441,10 +441,10 @@ sub country2lang {
my ($lang1, $lang2);
$lang1 ||= $country2lang{$country};
- $lang1 ||= first(grep { /^$country/ } list());
- $lang1 ||= first(grep { /_$uc_country/ } list());
- $lang2 ||= first(grep { int grep { /^$country/ } split(':', lang2LANGUAGE($_)) } list());
- $lang2 ||= first(grep { int grep { /_$uc_country/ } split(':', lang2LANGUAGE($_)) } list());
+ $lang1 ||= find { /^$country/ } list();
+ $lang1 ||= find { /_$uc_country/ } list();
+ $lang2 ||= find { int grep { /^$country/ } split(':', lang2LANGUAGE($_)) } list();
+ $lang2 ||= find { int grep { /_$uc_country/ } split(':', lang2LANGUAGE($_)) } list();
($lang1 =~ /UTF-8/ && $lang2 !~ /UTF-8/ ? $lang2 || $lang1 : $lang1 || $lang2) || $default || 'en_US';
}
@@ -466,13 +466,13 @@ sub lang2kde_lang {
my $r;
$r ||= $valid_lang->(lang2LANG($lang));
- $r ||= first(grep { $valid_lang->($_) } split(':', lang2LANGUAGE($lang)));
+ $r ||= find { $valid_lang->($_) } split(':', lang2LANGUAGE($lang));
$r || $default || 'C';
}
sub kde_lang2lang {
my ($klang, $default) = @_;
- first(grep { /^$klang/ } list()) || $default || 'en_US';
+ (find { /^$klang/ } list()) || $default || 'en_US';
}
sub kde_lang_country2lang {
@@ -581,8 +581,8 @@ sub set {
if ($lang && !exists $languages{$lang}) {
#- try to find the best lang
- my ($lang2) = grep { /^\Q$lang/ } list(); #- $lang is not precise enough, choose the first complete
- my ($lang3) = grep { $lang =~ /^\Q$_/ } list(); #- $lang is too precise, choose the first substring matching
+ my $lang2 = find { /^\Q$lang/ } list(); #- $lang is not precise enough, choose the first complete
+ my $lang3 = find { $lang =~ /^\Q$_/ } list(); #- $lang is too precise, choose the first substring matching
log::l("lang::set: fixing $lang with ", $lang2 || $lang3);
$lang = $lang2 || $lang3;
}