@@ -369,16 +369,24 @@ 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+ }
378379
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 );
380+ if (!$ template ->parent ) {
381+ $ lang ->load ('tpl_ ' . $ template ->template , JPATH_BASE )
382+ || $ lang ->load ('tpl_ ' . $ template ->template , JPATH_THEMES . '/ ' . $ template ->template );
383+ } else {
384+ $ lang ->load ('tpl_ ' . $ template ->template , JPATH_BASE )
385+ || $ lang ->load ('tpl_ ' . $ template ->template , JPATH_THEMES . '/ ' . $ template ->template );
386+ $ lang ->load ('tpl_ ' . $ template ->parent , JPATH_THEMES . '/ ' . $ template ->parent )
387+ || $ lang ->load ('tpl_ ' . $ template ->parent , JPATH_BASE );
388+ }
389+ }
382390
383391 // Change the template folder if alternative layout is in different template
384392 if (isset ($ layoutTemplate ) && $ layoutTemplate !== '_ ' && $ layoutTemplate != $ template ->template ) {
0 commit comments