/[web]/nav/lib.php
ViewVC logotype

Diff of /nav/lib.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3063 by leuhmanu, Sun Feb 2 23:19:20 2014 UTC revision 3207 by filip, Sun Apr 20 16:32:11 2014 UTC
# Line 126  class NCache Line 126  class NCache
126    
127  class l10n  class l10n
128  {  {
129      public static $t;  //    public static $t;
130    
131      /**      /**
132       * Load langs/$lang.lang into global $_t array.       * Load langs/$lang.lang into global $_t array.
# Line 143  class l10n Line 143  class l10n
143          if ($lang == 'en')          if ($lang == 'en')
144              return;              return;
145    
146          $lang_file  = __DIR__ . '/langs/' . $lang . '.lang';          $po_file    = __DIR__ . '/langs/' . $lang . '.po';
147          $cache_file = __DIR__ . '/var/tmp/cache/nav_lang_' . $lang . '.php';          $cache_file = __DIR__ . '/var/tmp/cache/nav_lang_' . $lang . '.php';
148          $lang_ts    = filemtime($lang_file);          $po_ts      = filemtime($po_file);
149    
150          if (file_exists($cache_file)) {          if (file_exists($cache_file)) {
151              include $cache_file;              include $cache_file;
152              if ($_ts > $lang_ts)              if ($_ts > $po_ts)
153                  return;                  return;
154          }          }
155    
156          if (file_exists($lang_file)) {          if (file_exists($po_file)) {
157                $dictionary = phpmo_parse_po_file($po_file);
158    
159              $f = file($lang_file);              foreach ($dictionary as $key => $value) {
160                    if ($key != '') {
161              foreach ($f as $k => $v) {                      if ($value['msgstr'][0] != '') {
162                            $_t[trim($key)] = trim($value['msgstr'][0]);
163                  if (substr($v, 0, 1) == ';'                      } else {
164                      && !empty($f[$k+1]))                          $_t[trim($key)] = trim($key);
165                  {                      }
                     $_t[trim(substr($v, 1))] = trim($f[$k+1]);  
166                  }                  }
167              }              }
168    
             //  
169              $_t_data = var_export($_t, true);              $_t_data = var_export($_t, true);
170              $cache   = <<<P              $cache   = <<<P
171  <?php  <?php
172  /**! Generated. Do not edit. */  /**! Generated. Do not edit. */
173    
174  // filemtime($lang_file)  // filemtime($po_file)
175  \$_ts = $lang_ts;  \$_ts = $po_ts;
176    
177  // $lang strings  // $lang strings
178  global \$_t;  global \$_t;

Legend:
Removed from v.3063  
changed lines
  Added in v.3207

  ViewVC Help
Powered by ViewVC 1.1.30