summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2015-02-08 14:28:56 +0000
committerColin Guthrie <colin@mageia.org>2015-02-08 15:30:26 +0000
commit6c23072af9db257153d993e6a87bfc02b69a2263 (patch)
tree19810554501166b11e424b849959d53bb5709bf1 /perl-install
parent8598eb09637c23d2f21d4807d30c691b5cb17dbd (diff)
downloaddrakx-6c23072af9db257153d993e6a87bfc02b69a2263.tar
drakx-6c23072af9db257153d993e6a87bfc02b69a2263.tar.gz
drakx-6c23072af9db257153d993e6a87bfc02b69a2263.tar.bz2
drakx-6c23072af9db257153d993e6a87bfc02b69a2263.tar.xz
drakx-6c23072af9db257153d993e6a87bfc02b69a2263.zip
i18n: Use the x-distro /etc/locale.conf file instead of /etc/sysconfig/i18n
Ensure we read and write the /etc/locale.conf file, but still support reading from /etc/sysconfig/i18n to cope with upgrades.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/any.pm1
-rw-r--r--perl-install/lang.pm24
-rwxr-xr-xperl-install/standalone/finish-install.xsetup8
4 files changed, 29 insertions, 5 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index f03596124..79c5e0cbe 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,4 @@
+- i18n: Use the x-distro /etc/locale.conf file instead of /etc/sysconfig/i18n
- drakedm: Do not use ancient dm init script to restart DM
Version 16.53 - 6 February 2015
diff --git a/perl-install/any.pm b/perl-install/any.pm
index e3bc3b3ae..8042a5539 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -1258,6 +1258,7 @@ sub report_bug {
header("urpmi.cfg"), cat_("$::prefix/etc/urpmi/urpmi.cfg"),
header("modprobe.preload"), cat_("$::prefix/etc/modprobe.preload"),
header("sysconfig/i18n"), cat_("$::prefix/etc/sysconfig/i18n"),
+ header("locale.conf"), cat_("$::prefix/etc/locale.conf"),
header("/proc/iomem"), cat_("/proc/iomem"),
header("/proc/ioport"), cat_("/proc/ioports"),
map_index { even($::i) ? header($_) : $_ } @other;
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 3dc28336a..702a43d32 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -579,7 +579,10 @@ The list of locales supported by glibc.
#- this list is built with the following command:
#- urpmf LC_CTYPE | egrep '/usr/share/locale/[a-z]' | cut -d'/' -f5 | sed 's/\.\(UTF-8\|ARM\|EUC\|GB.\|ISO\|KOI\|TCVN\).*\|\@\(euro\|iqtelif.*\)//' | sort -u | tr '\n' ' ';echo
our @locales = qw(aa_DJ aa_ER aa_ER@saaho aa_ET af_ZA ak_GH am_ET an_ES anp_IN ar_AE ar_BH ar_DZ ar_EG ar_IN ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SS ar_SY ar_TN ar_YE as_IN ast_ES ayc_PE az_AZ be_BY be_BY@latin bem_ZM ber_DZ ber_MA bg_BG bho_IN bn_BD bn_IN bo_CN bo_IN br_FR brx_IN bs_BA byn_ER ca_AD ca_ES ca_FR ca_IT cmn_TW crh_UA csb_PL cs_CZ cv_RU cy_GB da_DK de_AT de_BE de_CH de_DE de_LU doi_IN dv_MV dz_BT el_CY el_GR en_AG en_AU en_BE en_BW en_CA en_DK en_GB en_HK en_IE en_IN en_NG en_NZ en_PH en_SG en_US en_ZA en_ZM en_ZW eo_XX es_AR es_BO es_CL es_CO es_CR es_CU es_DO es_EC es_ES es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es@tradicional es_US es_UY es_VE et_EE eu_ES fa_IR ff_SN fi_FI fil_PH fo_FO fr_BE fr_CA fr_CH fr_FR fr_LU fur_IT fy_DE fy_NL ga_IE gd_GB gez_ER gez_ER@abegede gez_ET gez_ET@abegede gl_ES gu_IN gv_GB hak_TW ha_NG he_IL hi_IN hne_IN hr_HR hsb_DE ht_HT hu_HU hy_AM ia_FR id_ID ig_NG ik_CA is_IS it_CH it_IT iu_CA iw_IL ja_JP ka_GE kk_KZ kl_GL km_KH kn_IN kok_IN ko_KR ks_IN ks_IN@devanagari ku_TR kw_GB ky_KG lb_LU lg_UG li_BE lij_IT li_NL lo_LA lt_LT lv_LV lzh_TW mag_IN mai_IN mg_MG mhr_RU mi_NZ mk_MK ml_IN mni_IN mn_MN mr_IN ms_MY mt_MT my_MM nan_TW nan_TW@latin nb_NO nds_DE nds_DE@traditional nds_NL ne_NP nhn_MX niu_NU niu_NZ nl_AW nl_BE nl_NL nn_NO nr_ZA nso_ZA oc_FR om_ET om_KE or_IN os_RU pa_IN pap_AN pap_AW pap_CW pa_PK pl_PL ps_AF pt_BR pt_PT quz_PE ro_RO ru_RU ru_UA rw_RW sa_IN sat_IN sc_IT sd_IN sd_IN@devanagari se_NO shs_CA sid_ET si_LK sk_SK sl_SI so_DJ so_ET so_KE so_SO sq_AL sq_MK sr_ME sr_RS sr_RS@latin ss_ZA st_ZA sv_FI sv_SE sw_KE sw_TZ sw_XX szl_PL ta_IN ta_LK te_IN tg_TJ the_NP th_TH ti_ER ti_ET tig_ER tk_TM tl_PH tn_ZA tr_CY tr_TR ts_ZA tt_RU ug_CN uk_UA unm_US ur_IN ur_PK uz_UZ uz_UZ@cyrillic ve_ZA vi_VN wa_BE wae_CH wal_ET wo_SN xh_ZA yi_US yo_NG yue_HK zh_CN zh_HK zh_SG zh_TW zu_ZA);
-
+
+# (cg) Taken from systemd/src/locale/localed.c
+my @locale_conf_fields = qw(LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION);
+
sub standard_locale {
my ($lang, $country, $prefer_lang) = @_;
@@ -1336,9 +1339,14 @@ If $b_user_only is set, reads the user config, else read the system config.
sub read {
my ($b_user_only) = @_;
- my ($f1, $f2) = ("$::prefix$ENV{HOME}/.i18n", "$::prefix/etc/sysconfig/i18n");
+ my $f1 = "$::prefix$ENV{HOME}/.i18n";
+ my $f2 = "$::prefix/etc/locale.conf";
+ # (cg) Only use the 'legacy' config name when the new one doesn't exist
+ $f2 = "$::prefix/etc/sysconfig/i18n" if ! -e $f2 && -e "$::prefix/etc/sysconfig/i18n";
my %h = getVarsFromSh($b_user_only && -e $f1 ? $f1 : $f2);
- my $locale = system_locales_to_ourlocale($h{LC_MESSAGES} || 'en_US', $h{LC_MONETARY} || 'en_US');
+ # Fill in defaults (from LANG= variable)
+ %h = map { $_ => $h{$_} || $h{'LANG'} || 'en_US' } @locale_conf_fields;
+ my $locale = system_locales_to_ourlocale($h{LC_MESSAGES}, $h{LC_MONETARY});
if (find { $h{$_} } @IM_i18n_fields) {
my $current_IM = find {
@@ -1453,6 +1461,16 @@ sub write {
log::explanations(qq(Setting l10n configuration in "$file"));
setVarsInShMode($::prefix . $file, 0644, $h);
+ if (!$b_user_only) {
+ $file = '/etc/locale.conf';
+ log::explanations(qq(Setting locale configuration in "$file"));
+ # Only include valid fields and ommit any that are the same as LANG to make it cleaner
+ # (cleanup logic copied from systemd)
+ my @filtered_keys = grep { exists $h->{$_} && ($_ eq 'LANG' || !exists $h->{'LANG'} || $h->{$_} ne $h->{'LANG'}) } @locale_conf_fields;
+ my $filtered = { map { $_ => $h->{$_} } @filtered_keys };
+ setVarsInShMode($::prefix . $file, 0644, $filtered);
+ }
+
run_program::rooted($::prefix, 'grub-gfxmenu', '--quiet', '--lang', $locale->{lang}) if !$b_user_only;
my $charset = l2charset($locale->{lang});
diff --git a/perl-install/standalone/finish-install.xsetup b/perl-install/standalone/finish-install.xsetup
index aebe4db28..1b53e9ff8 100755
--- a/perl-install/standalone/finish-install.xsetup
+++ b/perl-install/standalone/finish-install.xsetup
@@ -5,8 +5,12 @@
if [ -f /etc/sysconfig/finish-install -a -x /usr/sbin/finish-install ]; then
. /etc/sysconfig/finish-install
if [ "$FINISH_INSTALL" = yes ]; then
- if [ -r /etc/sysconfig/i18n ]; then
- . /etc/sysconfig/i18n
+ if [ -r /etc/sysconfig/i18n -o -r /etc/locale.conf ]; then
+ if [ -r /etc/locale.conf ]; then
+ . /etc/locale.conf
+ else
+ . /etc/sysconfig/i18n
+ fi
export LANGUAGE LC_ADDRESS LC_COLLATE LC_NAME LC_NUMERIC LC_MEASUREMENT LC_TIME \
LANG LC_IDENTIFICATION LC_MESSAGES LC_CTYPE LC_TELEPHONE LC_MONETARY LC_PAPER
fi