diff options
Diffstat (limited to 'lib.php')
-rw-r--r-- | lib.php | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -126,7 +126,7 @@ class NCache class l10n { - public static $t; +// public static $t; /** * Load langs/$lang.lang into global $_t array. @@ -143,37 +143,36 @@ class l10n if ($lang == 'en') return; - $lang_file = __DIR__ . '/langs/' . $lang . '.lang'; + $po_file = __DIR__ . '/langs/' . $lang . '.po'; $cache_file = __DIR__ . '/var/tmp/cache/nav_lang_' . $lang . '.php'; - $lang_ts = filemtime($lang_file); + $po_ts = filemtime($po_file); if (file_exists($cache_file)) { include $cache_file; - if ($_ts > $lang_ts) + if ($_ts > $po_ts) return; } - if (file_exists($lang_file)) { + if (file_exists($po_file)) { + $dictionary = phpmo_parse_po_file($po_file); - $f = file($lang_file); - - foreach ($f as $k => $v) { - - if (substr($v, 0, 1) == ';' - && !empty($f[$k+1])) - { - $_t[trim(substr($v, 1))] = trim($f[$k+1]); + foreach ($dictionary as $key => $value) { + if ($key != '') { + if ($value['msgstr'][0] != '') { + $_t[trim($key)] = trim($value['msgstr'][0]); + } else { + $_t[trim($key)] = trim($key); + } } } - // $_t_data = var_export($_t, true); $cache = <<<P <?php /**! Generated. Do not edit. */ -// filemtime($lang_file) -\$_ts = $lang_ts; +// filemtime($po_file) +\$_ts = $po_ts; // $lang strings global \$_t; |