Skip to content

Commit bf77a48

Browse files
committed
lang order
1 parent 2afb305 commit bf77a48

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

libraries/src/Document/HtmlDocument.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,9 +775,12 @@ protected function _fetchTemplate($params = [])
775775

776776
// 1.5 or core then 1.6
777777
$lang->load('tpl_' . $template, JPATH_BASE)
778-
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, JPATH_BASE))
779-
|| $lang->load('tpl_' . $template, $directory . '/' . $template)
780-
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, $directory . '/' . $inherits));
778+
|| $lang->load('tpl_' . $template, $directory . '/' . $template);
779+
780+
if ($inherits) {
781+
$lang->load('tpl_' . $inherits, $directory . '/' . $inherits)
782+
|| $lang->load('tpl_' . $inherits, JPATH_BASE);
783+
}
781784

782785
// Assign the variables
783786
$this->baseurl = Uri::base(true);

libraries/src/MVC/View/HtmlView.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,22 @@ public function loadTemplate($tpl = null)
369369
$file = preg_replace('/[^A-Z0-9_\.-]/i', '', $file);
370370
$tpl = isset($tpl) ? preg_replace('/[^A-Z0-9_\.-]/i', '', $tpl) : $tpl;
371371

372-
try {
373-
// Load the language file for the template
374-
$lang = $this->getLanguage();
375-
} catch (\UnexpectedValueException $e) {
376-
$lang = Factory::getApplication()->getLanguage();
377-
}
372+
if (Factory::getApplication()->getDocument()->getType() !== 'html') {
373+
try {
374+
// Load the language file for the template
375+
$lang = $this->getLanguage();
376+
} catch (\UnexpectedValueException $e) {
377+
$lang = Factory::getApplication()->getLanguage();
378+
}
379+
380+
$lang->load('tpl_' . $template->template, JPATH_BASE)
381+
|| $lang->load('tpl_' . $template->template, JPATH_THEMES . '/' . $template->template);
378382

379-
$lang->load('tpl_' . $template->template, JPATH_BASE)
380-
|| $lang->load('tpl_' . $template->parent, JPATH_THEMES . '/' . $template->parent)
381-
|| $lang->load('tpl_' . $template->template, JPATH_THEMES . '/' . $template->template);
383+
if ($template->parent) {
384+
$lang->load('tpl_' . $template->parent, JPATH_THEMES . '/' . $template->parent)
385+
|| $lang->load('tpl_' . $template->parent, JPATH_BASE);
386+
}
387+
}
382388

383389
// Change the template folder if alternative layout is in different template
384390
if (isset($layoutTemplate) && $layoutTemplate !== '_' && $layoutTemplate != $template->template) {

0 commit comments

Comments
 (0)