summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-09-05 20:25:30 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-09-05 20:25:30 +0000
commitc17fa5794c2872da681650ea516d0fd61612b81f (patch)
tree039d5285ebc4e9811ae720b56c8762323339eaf5
parentc8e3da9f9c1a4f220f731bc08cc1ae718fe53c53 (diff)
downloaddrakx-backup-do-not-use-c17fa5794c2872da681650ea516d0fd61612b81f.tar
drakx-backup-do-not-use-c17fa5794c2872da681650ea516d0fd61612b81f.tar.gz
drakx-backup-do-not-use-c17fa5794c2872da681650ea516d0fd61612b81f.tar.bz2
drakx-backup-do-not-use-c17fa5794c2872da681650ea516d0fd61612b81f.tar.xz
drakx-backup-do-not-use-c17fa5794c2872da681650ea516d0fd61612b81f.zip
add support for "variants" as explained by pablo (in uz@Cyrl the @Cyrl is a variant)
-rw-r--r--perl-install/lang.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 81127e3a4..c35ebbf1e 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -412,15 +412,22 @@ sub standard_locale {
$prefer_lang && member($lang, @locales) and return $lang;
length($lang) > 2 and $lang =~ s/^(..).*/$1/, goto retry;
}
-
+
+sub fix_variant {
+ my ($locale) = @_;
+ #- uz@Cyrl_UZ -> uz_UZ@Cyrl
+ $locale =~ s/(\@\w+)_/_/;
+ $locale . $1;
+}
+
sub getlocale_for_lang {
my ($lang, $country, $o_utf8) = @_;
- (standard_locale($lang, $country, 'prefer_lang') || l2locale($lang)) . ($o_utf8 ? '.UTF-8' : '');
+ fix_variant((standard_locale($lang, $country, 'prefer_lang') || l2locale($lang)) . ($o_utf8 ? '.UTF-8' : ''));
}
sub getlocale_for_country {
my ($lang, $country, $o_utf8) = @_;
- (standard_locale($lang, $country, '') || c2locale($country)) . ($o_utf8 ? '.UTF-8' : '');
+ fix_variant((standard_locale($lang, $country, '') || c2locale($country)) . ($o_utf8 ? '.UTF-8' : ''));
}
sub getLANGUAGE {
@@ -841,6 +848,7 @@ sub pack_langs {
sub system_locales_to_ourlocale {
my ($locale_lang, $locale_country) = @_;
my $locale = {};
+ my $variant = $locale_lang =~ s/(\@\w+)// && $1;
my $locale_lang_no_encoding = $locale_lang =~ /(.*)\./ ? $1 : $locale_lang;
if (member($locale_lang_no_encoding, list_langs())) {
#- special lang's such as en_US pt_BR
@@ -848,6 +856,7 @@ sub system_locales_to_ourlocale {
} else {
($locale->{lang}) = $locale_lang =~ /^(..)/;
}
+ $locale->{lang} .= $variant;
($locale->{country}) = $locale_country =~ /^.._(..)/;
$locale->{utf8} = $locale_lang =~ /UTF-8/;
#- safe fallbacks