aboutsummaryrefslogtreecommitdiffstats
path: root/_nav/lib.php
diff options
context:
space:
mode:
authorFilip Komar <filip@mageia.org>2014-03-31 16:50:03 +0000
committerFilip Komar <filip@mageia.org>2014-03-31 16:50:03 +0000
commitdec16fcfc20d9268418c04beff83183b7a784ff9 (patch)
tree6d9fde8a0dc4a0533c7c401339434f968a718394 /_nav/lib.php
parent710ddc11547c7d5f14011f7a5a24c5b888b50f49 (diff)
downloadwww-dec16fcfc20d9268418c04beff83183b7a784ff9.tar
www-dec16fcfc20d9268418c04beff83183b7a784ff9.tar.gz
www-dec16fcfc20d9268418c04beff83183b7a784ff9.tar.bz2
www-dec16fcfc20d9268418c04beff83183b7a784ff9.tar.xz
www-dec16fcfc20d9268418c04beff83183b7a784ff9.zip
mognase converted to gettext
Diffstat (limited to '_nav/lib.php')
-rw-r--r--_nav/lib.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/_nav/lib.php b/_nav/lib.php
index 4b573d54c..1aa791998 100644
--- a/_nav/lib.php
+++ b/_nav/lib.php
@@ -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;