<?php
/* language file for german variables */
$lang = array();
+$lang['languageCode'] = 'de';
$lang['header.welcome'] = 'Angemeldet als: {$username}';
$lang['datatable.empty'] = 'Keine Daten vorhanden.';
$lang['datatable.first'] = 'Erste';
<?php
/* language file for english variables */
$lang = array();
+$lang['languageCode'] = 'en';
$lang['header.welcome'] = 'Logged in as: {$username}';
$lang['datatable.empty'] = 'No data available in table';
$lang['datatable.first'] = 'First';
if (isset($lang[$item])) {
if (strpos($lang[$item], self::getTPL()->left_delimiter) !== false && strpos($lang[$item], self::getTPL()->right_delimiter) !== false) {
$data = str_replace("\$", '$', $lang[$item]);
- $template_class = self::getTPL()->template_class;
- $template = new $template_class('eval:'.$data, self::getTPL(), self::getTPL());
- return $template->fetch();
+ $dir = self::getTPL()->getTemplateDir();
+
+ if (is_array($dir)) {
+ $dir = $dir[0];
+ }
+
+ $filename = "lang.".$lang['languageCode'].".".$content.".tpl";
+ if (file_exists($dir.$filename)) {
+ $mtime = filemtime($dir.$filename);
+ $maxLifetime = 3600;
+
+ if ($mtime === false || ($maxLifetime > 0 && (time() - $mtime) > $maxLifetime)) {
+ @unlink($dir.$filename);
+ }
+ }
+
+ if (!file_exists($dir.$filename)) {
+ $h = fopen($dir.$filename, "a+");
+ fwrite($h, $lang[$content]);
+ fclose($h);
+ }
+
+ return self::getTPL()->fetch($filename);
}
return $lang[$item];
if (isset($lang[$content])) {
if (strpos($lang[$content], $template->smarty->left_delimiter) !== false && strpos($lang[$content], $template->smarty->right_delimiter) !== false) {
$data = str_replace("\$", '$', $lang[$content]);
- $_template = new $template->smarty->template_class('eval:'.$data, $template->smarty, $template);
- return $_template->fetch();
+
+ $dir = $template->smarty->getTemplateDir();
+
+ if (is_array($dir)) {
+ $dir = $dir[0];
+ }
+
+ $filename = "lang.".$lang['languageCode'].".".$content.".tpl";
+ if (file_exists($dir.$filename)) {
+ $mtime = filemtime($dir.$filename);
+ $maxLifetime = 3600;
+
+ if ($mtime === false || ($maxLifetime > 0 && (time() - $mtime) > $maxLifetime)) {
+ @unlink($dir.$filename);
+ }
+ }
+
+ if (!file_exists($dir.$filename)) {
+ $h = fopen($dir.$filename, "a+");
+ fwrite($h, $lang[$content]);
+ fclose($h);
+ }
+
+ return $template->smarty->fetch($filename);
}
return $lang[$content];