mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 19:08:50 +03:00
Improved language detection code
This commit is contained in:
parent
02e6198f17
commit
3bac68dffb
3 changed files with 18 additions and 36 deletions
|
|
@ -138,14 +138,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
}
|
||||
}
|
||||
if ('language' === $sParamKey) {
|
||||
$aLang = \SnappyMail\L10n::getLanguages('admin_panel' === $sSectionKey);
|
||||
$sLanguage = \strtr($mParamValue, '_', '-');
|
||||
if (!\in_array($sLanguage, $aLang)) {
|
||||
if (\str_contains($sLanguage, '-')) {
|
||||
$sLanguage = \strtok($sLanguage, '-');
|
||||
}
|
||||
}
|
||||
$mParamValue = \in_array($sLanguage, $aLang) ? $sLanguage : 'en';
|
||||
$mParamValue = \SnappyMail\L10n::validLanguage($mParamValue, 'admin_panel' === $sSectionKey) ?: 'en';
|
||||
}
|
||||
parent::Set($sSectionKey, $sParamKey, $mParamValue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue