summaryrefslogtreecommitdiffstats
path: root/perl-install/lang.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2019-04-18 21:54:15 +0100
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2019-04-20 21:35:26 +0100
commit874e4658236fa8f13581ca46999f7a11d7e7a667 (patch)
tree6f496eb22b11853d49eabbe54162e244fb52b349 /perl-install/lang.pm
parentbf24ef177504839892271171ccef6533bf449263 (diff)
downloaddrakx-874e4658236fa8f13581ca46999f7a11d7e7a667.tar
drakx-874e4658236fa8f13581ca46999f7a11d7e7a667.tar.gz
drakx-874e4658236fa8f13581ca46999f7a11d7e7a667.tar.bz2
drakx-874e4658236fa8f13581ca46999f7a11d7e7a667.tar.xz
drakx-874e4658236fa8f13581ca46999f7a11d7e7a667.zip
Store country code in /etc/locale.conf (mga#24671)
This allows the installer to show the correct country when performing an upgrade.
Diffstat (limited to 'perl-install/lang.pm')
-rw-r--r--perl-install/lang.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 9e2127d35..5097fc735 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -1321,7 +1321,7 @@ sub pack_langs {
}
sub system_locales_to_ourlocale {
- my ($locale_lang, $locale_country) = @_;
+ my ($locale_lang, $locale_country, $o_country) = @_;
my $locale = {};
my $h = analyse_locale_name($locale_lang);
my $locale_lang_no_encoding = join('_', $h->{main}, if_($h->{country}, $h->{country}));
@@ -1329,7 +1329,7 @@ sub system_locales_to_ourlocale {
$locale_lang_no_encoding : #- special lang's such as en_US pt_BR
$h->{main};
$locale->{lang} .= '@' . $h->{variant} if $h->{variant};
- $locale->{country} = analyse_locale_name($locale_country)->{country};
+ $locale->{country} = $o_country || analyse_locale_name($locale_country)->{country};
$locale->{utf8} = $h->{charset} && $h->{charset} eq 'UTF-8';
#- safe fallbacks
@@ -1372,7 +1372,7 @@ sub read {
my %h = getVarsFromSh($b_user_only && -e $f1 ? $f1 : $f2);
# Fill in defaults (from LANG= variable)
$h{$_} ||= $h{LANG} || 'en_US' foreach @locale_conf_fields;
- my $locale = system_locales_to_ourlocale($h{LC_MESSAGES}, $h{LC_MONETARY});
+ my $locale = system_locales_to_ourlocale($h{LC_MESSAGES}, $h{LC_MONETARY}, $h{COUNTRY});
if (find { $h{$_} } @IM_i18n_fields) {
my $current_IM = find {
@@ -1401,6 +1401,7 @@ sub i18n_env {
my $h = {
XKB_IN_USE => '',
+ COUNTRY => $locale->{country},
(map { $_ => $locale_lang } qw(LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_TIME)),
LANGUAGE => getLANGUAGE($locale->{lang}, $locale->{country}, $locale->{utf8}),
(map { $_ => $locale_country } qw(LC_NUMERIC LC_MONETARY LC_ADDRESS LC_MEASUREMENT LC_NAME LC_PAPER LC_IDENTIFICATION LC_TELEPHONE))
@@ -1495,6 +1496,7 @@ sub write {
my @filtered_keys = grep { exists $h->{$_} && ($_ eq 'LANG' || !exists $h->{LANG} || $h->{$_} ne $h->{LANG}) } @locale_conf_fields;
my @filtered_input = grep { exists $h->{$_} } @IM_i18n_fields;
push @filtered_keys, @filtered_input;
+ push @filtered_keys, 'COUNTRY' if exists $h->{COUNTRY};
my $h2 = { map { $_ => $h->{$_} } @filtered_keys };
setVarsInShMode($::prefix . $file, 0644, $h2);