summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-11-08 15:55:58 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-11-08 15:55:58 +0000
commit54710bb802a25da8901931250652fb1dd85ee780 (patch)
treea20df6a9f23c49b030ee74fccd9383de16ccba7b /perl-install
parent85fbbce70f17538cb4a9c5a1ad1a212f2e96487c (diff)
downloaddrakx-54710bb802a25da8901931250652fb1dd85ee780.tar
drakx-54710bb802a25da8901931250652fb1dd85ee780.tar.gz
drakx-54710bb802a25da8901931250652fb1dd85ee780.tar.bz2
drakx-54710bb802a25da8901931250652fb1dd85ee780.tar.xz
drakx-54710bb802a25da8901931250652fb1dd85ee780.zip
- cleanup:
- $lang is a string, $locale is always an object
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/lang.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 29fba2f23..eeb773355 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -476,21 +476,21 @@ sub standard_locale {
}
sub fix_variant {
- my ($locale) = @_;
+ my ($lang) = @_;
#- uz@Cyrl_UZ -> uz_UZ@Cyrl
- $locale =~ s/(.*)(\@\w+)(_.*)/$1$3$2/;
- $locale;
+ $lang =~ s/(.*)(\@\w+)(_.*)/$1$3$2/;
+ $lang;
}
sub analyse_locale_name {
- my ($locale) = @_;
- $locale =~ /^(.*?) (?:_(.*?))? (?:\.(.*?))? (?:\@(.*?))? $/x &&
+ my ($lang) = @_;
+ $lang =~ /^(.*?) (?:_(.*?))? (?:\.(.*?))? (?:\@(.*?))? $/x &&
{ main => $1, country => $2, charset => $3, variant => $4 };
}
sub locale_to_main_locale {
- my ($locale) = @_;
- lc(analyse_locale_name($locale)->{main});
+ my ($lang) = @_;
+ lc(analyse_locale_name($lang)->{main});
}
sub getlocale_for_lang {
@@ -513,9 +513,9 @@ sub getLANGUAGE {
sub country_to_locales {
my ($country) = @_;
- my $locale = c2locale($country) or return;
+ my $lang = c2locale($country) or return;
- uniq($locale, grep {
+ uniq($lang, grep {
my $h = analyse_locale_name($_) or internal_error();
$h->{country} eq $country;
} @locales);
@@ -1011,9 +1011,11 @@ sub system_locales_to_ourlocale {
$locale->{lang} .= '@' . $h->{variant} if $h->{variant};
$locale->{country} = analyse_locale_name($locale_country)->{country};
$locale->{utf8} = $h->{charset} && $h->{charset} eq 'UTF-8';
+
#- safe fallbacks
$locale->{lang} ||= 'en_US';
$locale->{country} ||= 'US';
+
$locale;
}