summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perl-install/install2.pm2
-rw-r--r--perl-install/lang.pm9
2 files changed, 10 insertions, 1 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index 23343cd25..e6b6bf8d6 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -470,7 +470,7 @@ sub main {
$::noauto or modules::load_thiskind("usb");
eval { ($o->{mouse}, @{$o->{wacom} = []}) = mouse::detect() } unless $o->{nomouseprobe} || $o->{mouse};
- lang::set($o->{lang}); #- mainly for defcfg
+ $o->{lang} = lang::set($o->{lang}); #- mainly for defcfg
$o->{allowFB} = listlength(cat_("/proc/fb"));
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 3b2c65614..9f1fc44ce 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -319,6 +319,14 @@ sub getxim { $xim{$_[0]} }
sub set {
my ($lang) = @_;
+ if ($lang && !exists $languages{$lang}) {
+ #- try to find the best lang
+ my ($lang2) = grep { /^\Q$lang/ } list(); #- $lang is not precise enough, choose the first complete
+ my ($lang3) = grep { $lang =~ /^\Q$_/ } list(); #- $lang is too precise, choose the first substring matching
+ log::l("lang::set: fixing $lang with ", $lang2 || $lang3);
+ $lang = $lang2 || $lang3;
+ }
+
if ($lang && exists $languages{$lang}) {
#- use "packdrake -x" that follow symlinks and expand directory.
#- it is necessary as there is a lot of symlinks inside locale.cz2,
@@ -362,6 +370,7 @@ sub set {
delete $ENV{LANGUAGE};
delete $ENV{LINGUAS};
}
+ $lang;
}
sub langs {