@@ -367,16 +367,22 @@ public function loadTemplate($tpl = null)
367367 $ file = preg_replace ('/[^A-Z0-9_\.-]/i ' , '' , $ file );
368368 $ tpl = isset ($ tpl ) ? preg_replace ('/[^A-Z0-9_\.-]/i ' , '' , $ tpl ) : $ tpl ;
369369
370- try {
371- // Load the language file for the template
372- $ lang = $ this ->getLanguage ();
373- } catch (\UnexpectedValueException $ e ) {
374- $ lang = Factory::getApplication ()->getLanguage ();
375- }
370+ if (Factory::getApplication ()->getDocument ()->getType () !== 'html ' ) {
371+ try {
372+ // Load the language file for the template
373+ $ lang = $ this ->getLanguage ();
374+ } catch (\UnexpectedValueException $ e ) {
375+ $ lang = Factory::getApplication ()->getLanguage ();
376+ }
376377
377- $ lang ->load ('tpl_ ' . $ template ->template , JPATH_BASE )
378- || $ lang ->load ('tpl_ ' . $ template ->parent , JPATH_THEMES . '/ ' . $ template ->parent )
379- || $ lang ->load ('tpl_ ' . $ template ->template , JPATH_THEMES . '/ ' . $ template ->template );
378+ if ($ template ->parent ) {
379+ $ lang ->load ('tpl_ ' . $ template ->parent , JPATH_THEMES . '/ ' . $ template ->parent )
380+ || $ lang ->load ('tpl_ ' . $ template ->parent , JPATH_BASE );
381+ }
382+
383+ $ lang ->load ('tpl_ ' . $ template ->template , JPATH_BASE )
384+ || $ lang ->load ('tpl_ ' . $ template ->template , JPATH_THEMES . '/ ' . $ template ->template );
385+ }
380386
381387 // Change the template folder if alternative layout is in different template
382388 if (isset ($ layoutTemplate ) && $ layoutTemplate !== '_ ' && $ layoutTemplate != $ template ->template ) {
0 commit comments