summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-11-08 16:33:20 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-11-08 16:33:20 +0000
commit2048db8902dad7b19e88ea351f456071ca6903cf (patch)
tree7c23930227d835b775079375bd7b505fb3eda413 /perl-install
parent54710bb802a25da8901931250652fb1dd85ee780 (diff)
downloaddrakx-2048db8902dad7b19e88ea351f456071ca6903cf.tar
drakx-2048db8902dad7b19e88ea351f456071ca6903cf.tar.gz
drakx-2048db8902dad7b19e88ea351f456071ca6903cf.tar.bz2
drakx-2048db8902dad7b19e88ea351f456071ca6903cf.tar.xz
drakx-2048db8902dad7b19e88ea351f456071ca6903cf.zip
- localedrake:
o fix handling variant together with charset (eg: uz.UTF-8@Latn) (#35090)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS2
-rw-r--r--perl-install/install/NEWS2
-rw-r--r--perl-install/lang.pm40
3 files changed, 29 insertions, 15 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 9e61918d6..9aad03ef6 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,5 @@
+- localedrake:
+ o fix handling variant together with charset (eg: uz.UTF-8@Latn) (#35090)
- drakbug:
o prevent altering tool and the like when catching a bug (#35241)
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index ebc8510b2..043b89420 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,5 @@
+- localedrake:
+ o fix handling variant together with charset (eg: uz.UTF-8@Latn) (#35090)
- partitioning wizard: ensure existing_part and resize_fat are proposed before
wipe_drive
- in case of ftp/http media, we select basesystem before doing
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index eeb773355..c5f968bdd 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -461,25 +461,35 @@ our @locales = qw(aa_DJ aa_ER aa_ER@saaho aa_ET af_ZA am_ET an_ES ar_AE ar_BH ar
sub standard_locale {
my ($lang, $country, $prefer_lang) = @_;
- if (member("${lang}_${country}", @locales)) {
- "${lang}_${country}";
+ my $lang_ = force_lang_country($lang, $country);
+ if (member($lang_, @locales)) {
+ $lang_;
} elsif ($prefer_lang && member($lang, @locales)) {
$lang;
} else {
- my $main_locale = locale_to_main_locale($lang);
- if ($main_locale ne $lang) {
- standard_locale($main_locale, $country, $prefer_lang);
- } else {
- '';
- }
+ '';
}
}
-sub fix_variant {
- my ($lang) = @_;
- #- uz@Cyrl_UZ -> uz_UZ@Cyrl
- $lang =~ s/(.*)(\@\w+)(_.*)/$1$3$2/;
- $lang;
+sub force_lang_country {
+ my ($lang, $country) = @_;
+ my $h = analyse_locale_name($lang);
+ $h->{country} = $country;
+ analysed_to_lang($h);
+}
+
+sub force_lang_charset {
+ my ($lang, $charset) = @_;
+ my $h = analyse_locale_name($lang);
+ $h->{charset} = $charset;
+ analysed_to_lang($h);
+}
+
+sub analysed_to_lang {
+ my ($h) = @_;
+ $h->{main} . '_' . $h->{country} .
+ ($h->{charset} ? '.' . $h->{charset} : '') .
+ ($h->{variant} ? '@' . $h->{variant} : '');
}
sub analyse_locale_name {
@@ -495,12 +505,12 @@ sub locale_to_main_locale {
sub getlocale_for_lang {
my ($lang, $country, $o_utf8) = @_;
- fix_variant((standard_locale($lang, $country, 'prefer_lang') || l2locale($lang)) . ($o_utf8 ? '.UTF-8' : ''));
+ force_lang_charset(standard_locale($lang, $country, 'prefer_lang') || l2locale($lang), $o_utf8 && 'UTF-8');
}
sub getlocale_for_country {
my ($lang, $country, $o_utf8) = @_;
- fix_variant((standard_locale($lang, $country, '') || c2locale($country)) . ($o_utf8 ? '.UTF-8' : ''));
+ force_lang_charset(standard_locale($lang, $country, '') || c2locale($country), $o_utf8 && 'UTF-8');
}
sub getLANGUAGE {