From bf77a4816298c23b59911e30af7350180ae03935 Mon Sep 17 00:00:00 2001 From: Dimitris Grammatikogiannis Date: Wed, 22 Oct 2025 22:10:16 +0300 Subject: [PATCH] lang order --- libraries/src/Document/HtmlDocument.php | 9 ++++++--- libraries/src/MVC/View/HtmlView.php | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/libraries/src/Document/HtmlDocument.php b/libraries/src/Document/HtmlDocument.php index ed018d81a18bc..aaf3c1bde4341 100644 --- a/libraries/src/Document/HtmlDocument.php +++ b/libraries/src/Document/HtmlDocument.php @@ -775,9 +775,12 @@ protected function _fetchTemplate($params = []) // 1.5 or core then 1.6 $lang->load('tpl_' . $template, JPATH_BASE) - || ($inherits !== '' && $lang->load('tpl_' . $inherits, JPATH_BASE)) - || $lang->load('tpl_' . $template, $directory . '/' . $template) - || ($inherits !== '' && $lang->load('tpl_' . $inherits, $directory . '/' . $inherits)); + || $lang->load('tpl_' . $template, $directory . '/' . $template); + + if ($inherits) { + $lang->load('tpl_' . $inherits, $directory . '/' . $inherits) + || $lang->load('tpl_' . $inherits, JPATH_BASE); + } // Assign the variables $this->baseurl = Uri::base(true); diff --git a/libraries/src/MVC/View/HtmlView.php b/libraries/src/MVC/View/HtmlView.php index a926f17fc6ea4..af7021c21f60c 100644 --- a/libraries/src/MVC/View/HtmlView.php +++ b/libraries/src/MVC/View/HtmlView.php @@ -369,16 +369,22 @@ public function loadTemplate($tpl = null) $file = preg_replace('/[^A-Z0-9_\.-]/i', '', $file); $tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\.-]/i', '', $tpl) : $tpl; - try { - // Load the language file for the template - $lang = $this->getLanguage(); - } catch (\UnexpectedValueException $e) { - $lang = Factory::getApplication()->getLanguage(); - } + if (Factory::getApplication()->getDocument()->getType() !== 'html') { + try { + // Load the language file for the template + $lang = $this->getLanguage(); + } catch (\UnexpectedValueException $e) { + $lang = Factory::getApplication()->getLanguage(); + } + + $lang->load('tpl_' . $template->template, JPATH_BASE) + || $lang->load('tpl_' . $template->template, JPATH_THEMES . '/' . $template->template); - $lang->load('tpl_' . $template->template, JPATH_BASE) - || $lang->load('tpl_' . $template->parent, JPATH_THEMES . '/' . $template->parent) - || $lang->load('tpl_' . $template->template, JPATH_THEMES . '/' . $template->template); + if ($template->parent) { + $lang->load('tpl_' . $template->parent, JPATH_THEMES . '/' . $template->parent) + || $lang->load('tpl_' . $template->parent, JPATH_BASE); + } + } // Change the template folder if alternative layout is in different template if (isset($layoutTemplate) && $layoutTemplate !== '_' && $layoutTemplate != $template->template) {