Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 998eb8c

Browse files
author
the-djmaze
committed
Bugfix: default language error
the-djmaze#1579 (comment)
1 parent dd39d18 commit 998eb8c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function Set(string $sSectionKey, string $sParamKey, $mParamValue) : void
9696
{
9797
// Workarounds for the changed application structure
9898
if ('webmail' === $sSectionKey) {
99-
if ('language_admin' === $sSectionKey) {
99+
if ('language_admin' === $sParamKey) {
100100
$sSectionKey = 'admin_panel';
101101
$sParamKey = 'language';
102102
}
@@ -137,6 +137,16 @@ public function Set(string $sSectionKey, string $sParamKey, $mParamValue) : void
137137
$sParamKey = 'json_response_write_limit';
138138
}
139139
}
140+
if ('language' === $sParamKey) {
141+
$aLang = \SnappyMail\L10n::getLanguages('admin_panel' === $sSectionKey);
142+
$sLanguage = \strtr($mParamValue, '_', '-');
143+
if (!\in_array($sLanguage, $aLang)) {
144+
if (\str_contains($sLanguage, '-')) {
145+
$sLanguage = \strtok($sLanguage, '-');
146+
}
147+
}
148+
$mParamValue = \in_array($sLanguage, $aLang) ? $sLanguage : 'en';
149+
}
140150
parent::Set($sSectionKey, $sParamKey, $mParamValue);
141151
}
142152

0 commit comments

Comments
 (0)