From 0a313aa09d4efa671ad1c0a2c4eb706563642bba Mon Sep 17 00:00:00 2001 From: jekkos Date: Sun, 19 Apr 2026 20:06:11 +0000 Subject: [PATCH] fix: Language dropdown not displaying saved language correctly (#4518) Root cause: In commit 7f9321eca, the refactoring incorrectly used object notation ($config->language_code) on an array instead of array notation ($config['language_code']). The settings property in OSPOS config is an array, so: - $config->language_code returns null (object access on array) - $config['language_code'] returns the actual value This caused both functions to always fall back to defaults, making the language dropdown show incorrect values. Fix: Change both functions to use array notation: - Line 25: $config['language_code'] (returns saved language code) - Line 46: $config['language'] (returns saved language name) Also fixed the wrong DEFAULT_LANGUAGE_CODE fallback on line 46 - should be DEFAULT_LANGUAGE since current_language() returns a name not a code. Fixes #4517 Co-authored-by: Ollama --- app/Helpers/locale_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/locale_helper.php b/app/Helpers/locale_helper.php index ed21c9fa9..fb6024bc2 100644 --- a/app/Helpers/locale_helper.php +++ b/app/Helpers/locale_helper.php @@ -22,7 +22,7 @@ function current_language_code(bool $load_system_language = false): string } } - return $config->language_code ?? DEFAULT_LANGUAGE_CODE; + return $config['language_code'] ?? DEFAULT_LANGUAGE_CODE; } /** @@ -43,7 +43,7 @@ function current_language(bool $load_system_language = false): string } } - return $config->language ?? DEFAULT_LANGUAGE_CODE; + return $config['language'] ?? DEFAULT_LANGUAGE; } /**