Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9700daf6 authored by Akhil's avatar Akhil 🙂
Browse files

Patch findLanguage to get language from session

parent 8f405174
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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}/lib/private/L10N/Factory.php -i ${TMP_PATCH_DIR}/032-select-lang-from-session.patch

RUN rm -rf ${TMP_PATCH_DIR}

+21 −0
Original line number Diff line number Diff line
From: Akhil <akhil.potukuchi.ext@murena.com>
Date: Fri, 29 Nov 2023 17:50:00 +0530
Subject: [PATCH] Check session to select language

$_SERVER in IRequest is immutable but we want to switch the header to deliver translation files correctly

--- lib/private/L10N/Factory.php	2023-11-29 17:46:48.253716340 +0530
+++ lib/private/L10N/Factory-new.php	2023-11-29 17:47:26.194920628 +0530
@@ -478,7 +478,11 @@
 	 * @throws LanguageNotFoundException
 	 */
 	private function getLanguageFromRequest(?string $app = null): string {
-		$header = $this->request->getHeader('ACCEPT_LANGUAGE');
+		// $header = $this->request->getHeader('ACCEPT_LANGUAGE');
+		$header = '';
+		if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+			$header = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+		}
 		if ($header !== '') {
 			$available = $this->findAvailableLanguages($app);