mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
webif: Find correct language file when locale is in format xx_XX.utf8
This commit is contained in:
@@ -50,8 +50,8 @@ $language = $settings{'LANGUAGE'};
|
||||
# (it is a developper options)
|
||||
#
|
||||
sub reload {
|
||||
my $LG = &FindWebLanguage(shift);
|
||||
|
||||
my ($LG) = @_;
|
||||
%Lang::tr = (); # start with a clean array
|
||||
|
||||
# Use CacheLang if present & not empty.
|
||||
@@ -157,4 +157,23 @@ sub BuildCacheLang {
|
||||
&General::log ("WARNING: cannot build cachelang file for [$missed].") if ($error);
|
||||
return $error;
|
||||
}
|
||||
|
||||
sub FindWebLanguage() {
|
||||
my $lang = shift;
|
||||
|
||||
my @options = ($lang);
|
||||
|
||||
my ($shortlang, $encoding) = split(/\./, $lang);
|
||||
push(@options, $shortlang);
|
||||
|
||||
my ($language, $country) = split(/_/, $shortlang);
|
||||
push(@options, $language);
|
||||
|
||||
foreach my $option (@options) {
|
||||
return $option if (-e "${General::swroot}/langs/$option.pl");
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user