Fix root not added to internationalized template search

This commit is contained in:
M.Dent 2018-08-12 19:02:11 -04:00
parent 759a18685b
commit 9402f537b6

View File

@ -64,17 +64,20 @@ class SmartyTemplate implements TemplateEngine {
public function get_intltext_template($file, $root='') { public function get_intltext_template($file, $root='') {
$lang = \App::$language; $lang = \App::$language;
if ($root != '' && substr($root,-1) != '/' ) {
if(file_exists("view/$lang/$file")) $root .= '/';
$template_file = "view/$lang/$file"; }
elseif(file_exists("view/en/$file")) foreach (Array(
$template_file = "view/en/$file"; $root."view/$lang/$file",
else $root."view/en/$file",
$template_file = theme_include($file,$root); ''
) as $template_file) {
if (is_file($template_file)) { break; }
}
if ($template_file=='') {$template_file = theme_include($file,$root);}
if($template_file) { if($template_file) {
$template = new SmartyInterface(); $template = new SmartyInterface();
$template->filename = $template_file; $template->filename = $template_file;
return $template; return $template;
} }
return ""; return "";