diff --git a/Dockerfile b/Dockerfile index b30d660109bd08ba1327a636b0b1ac86c34dbf2d..f6657438565569b15c204c7375b13106092ae73b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,12 +10,12 @@ ARG EA_JOB_ID="738865" ARG LAUNCHER_JOB_ID="738816" ARG GOOGLE_INTEGRATION_VERSION="2.1.0" ARG DASHBOARD_JOB_ID="748055" -ARG SNAPPY_VERSION="2.29.1" +ARG SNAPPY_VERSION="2.29.4" ARG SNAPPY_THEME_VERSION="3.0.0" ARG USER_MIGRATION_JOB_ID="608716" ARG MEMORIES_VERSION="5.4.1" -RUN sed -i 's/26,0,8,2/26,0,8,12/' ${BASE_DIR}/version.php +RUN sed -i 's/26,0,8,2/26,0,8,13/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images @@ -144,6 +144,7 @@ RUN patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Reminder/ReminderService.php -i ${T RUN patch -u ${BASE_DIR}/apps/theming/lib/Themes/CommonThemeTrait.php -i ${TMP_PATCH_DIR}/026-primary-color-fix.patch RUN patch -u ${BASE_DIR}/lib/private/Preview/Watcher.php -i ${TMP_PATCH_DIR}/030-preview-watcher-null-check.patch RUN patch -u ${BASE_DIR}/lib/private/Template/JSResourceLocator.php -i ${TMP_PATCH_DIR}/031-theme-custom-app-translations.patch +RUN patch -u ${BASE_DIR}/custom_apps/snappymail/lib/Controller/PageController.php -i ${TMP_PATCH_DIR}/033-snappy-language-fix.patch RUN rm -rf ${TMP_PATCH_DIR} diff --git a/patches/033-snappy-language-fix.patch b/patches/033-snappy-language-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..51c78de2b368e5c8b20327a70702667a33ed2ed4 --- /dev/null +++ b/patches/033-snappy-language-fix.patch @@ -0,0 +1,85 @@ +From: Avinash Gusain +Date: Mon, 27 Nov 2023 13:40:00 +0530 +Subject: [PATCH] Snappy Language fix + +This set snappy language same is cloud language +--- PageController.php 2023-11-29 00:29:13 ++++ PageController-new.php 2023-12-08 20:27:04 +@@ -12,11 +12,10 @@ + + class PageController extends Controller + { +-// private IL10N $l; +- ++ private IL10N $l; + public function __construct(string $appName, IRequest $request, IL10N $l) { + parent::__construct($appName, $request); +-// $this->l = $l; ++ $this->l = $l; + $lang = \strtolower(\str_replace('_', '-', $l->getLocaleCode())); + if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $_SERVER['HTTP_ACCEPT_LANGUAGE'] = $lang; +@@ -69,8 +68,24 @@ + $oServiceActions = new \RainLoop\ServiceActions($oHttp, $oActions); + $sAppJsMin = $oConfig->Get('debug', 'javascript', false) ? '' : '.min'; + $sAppCssMin = $oConfig->Get('debug', 'css', false) ? '' : '.min'; +- $sLanguage = $oActions->GetLanguage(false); +- ++ $languageSetting = (bool) $oConfig->Get('webmail', 'allow_languages_on_settings', true); ++ if (!$languageSetting) { ++ $aResultLang = \json_decode(\file_get_contents(APP_VERSION_ROOT_PATH . 'app/localization/langs.json'), true); ++ if ($aResultLang === null) { ++ throw new \Exception('Error decoding JSON content.'); ++ } ++ $user = \OC::$server->getUserSession()->getUser(); ++ $userId = $user->getUID(); ++ $langCode = $config->getUserValue($userId, 'core', 'lang'); ++ $userLang = \OC::$server->getConfig()->getUserValue($userId, 'core', 'lang'); ++ $sLanguage = $this->determineLocale($langCode,$aResultLang['LANGS_NAMES_EN']); ++ // Check if $sLanguage is null ++ if ($sLanguage === null) { ++ $sLanguage = 'en'; // Assign 'en' if $sLanguage is null ++ } ++ }else { ++ $sLanguage = $oActions->GetLanguage(false); ++ } + $csp = new ContentSecurityPolicy(); + $sNonce = $csp->getSnappyMailNonce(); + +@@ -129,4 +144,36 @@ + { + return SnappyMailHelper::startApp(true); + } ++ /** ++ * Determine locale from user language. ++ * ++ * @param string $langCode The name of the input. ++ * @param array $languagesArray The value of the array. ++ * ++ * @return string return locale ++ */ ++ ++ private function determineLocale (string $langCode, array $languagesArray) : string { ++ // Direct check for the language code ++ if (isset($languagesArray[$langCode])) { ++ return $langCode; ++ } ++ ++ // Check with uppercase country code ++ $langCodeWithUpperCase = $langCode . '-' . strtoupper($langCode); ++ if (isset($languagesArray[$langCodeWithUpperCase])) { ++ return $langCodeWithUpperCase; ++ } ++ ++ // Iterating to find a match starting with langCode ++ foreach ($languagesArray as $localeKey => $localeValue) { ++ if (strpos($localeKey, $langCode) === 0) { ++ return $localeKey; ++ } ++ } ++ ++ // If no match is found ++ return null; ++ } ++ + }