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

Unverified Commit a3ec20df authored by Akhil's avatar Akhil
Browse files

Patch findLanguage to get language from session

parent 8f405174
Loading
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}

+20 −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

As we are unable to change the ACCEPT_LANGUAGE header for a public page, findLanguage always returns 'en'. To use this, do \OC::$server->getSession()->set('selected_language', $lang);

--- 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
@@ -213,6 +213,11 @@
 			}
 		}
 
+		$selectedLang = \OC::$server->getSession()->get('selected_language');;
+		if (!empty($selectedLang) && $this->languageExists($appId, $selectedLang)) {
+			return $selectedLang;
+		}
+		
 		// Step 4: Check the request headers
 		try {
 			// Try to get the language from the Request