Subversion Repositories LCARS

Rev

Rev 191 | Rev 214 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 191 Rev 210
Line 21... Line 21...
21
header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');
21
header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate');
22
22
23
/* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
23
/* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
24
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
24
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
25
25
-
 
26
// $vulcan = 'x-vulcan-latin';
-
 
27
$vulcan = 'vuh-Latn-Gol-modern';
26
$languages = array(
28
$languages = array(
27
  'en' => 'English',
29
  'en' => 'English',
28
  'de' => 'Deutsch',
30
  'de' => 'Deutsch',
29
//   'ru' => 'По-русски',
31
  'ru' => 'по-русски',
-
 
32
//   'x-klingon-latin' => array(
-
 
33
//     'key'  => 'tlh',
-
 
34
//     'name' => 'tlhIngan Hol'
-
 
35
//   ),
-
 
36
  $vulcan => array(
-
 
37
    'key' => 'vu',
-
 
38
    'name' => '<abbr title="Gen-lis">G-l</abbr> Vuhlkansu'
-
 
39
  )
30
);
40
);
31
41
-
 
42
-
 
43
/**
-
 
44
 * Returns the short language key.
-
 
45
 *
-
 
46
 * Needed for safely mapping extra-terrestrial languages.
-
 
47
 */
-
 
48
function language_key_short ($key)
-
 
49
{
-
 
50
  global $languages;
-
 
51
  preg_match('/^[^-]{2,3}/', $key, $matches);
-
 
52
  $language = $languages[$key];
-
 
53
  return isset($language['key']) ? $language['key'] : $matches[0];
-
 
54
}
-
 
55
-
 
56
/**
-
 
57
 * Returns the language name.
-
 
58
 *
-
 
59
 * Needed for safely mapping extra-terrestrial languages.
-
 
60
 */
-
 
61
function language_name ($key)
-
 
62
{
-
 
63
  global $languages;
-
 
64
  $language = $languages[$key];
-
 
65
  return isset($language['name']) ? $language['name'] : $language;
-
 
66
}
-
 
67
32
require_once 'Zend/Loader/StandardAutoloader.php';
68
require_once 'Zend/Loader/StandardAutoloader.php';
33
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
69
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
34
$loader->register();
70
$loader->register();
35
71
36
$translator = new Zend\I18n\Translator\Translator();
72
$translator = new Zend\I18n\Translator\Translator();
Line 46... Line 82...
46
 * using Zend Framework 2.1 Translate
82
 * using Zend Framework 2.1 Translate
47
 *
83
 *
48
 * @param string $s
84
 * @param string $s
49
 * @return string
85
 * @return string
50
 */
86
 */
51
function tr ($s)
87
function tr ($s, $lang = null)
52
{
88
{
53
  global $translator;
89
  global $translator;
54
  global $textDomain;
90
  global $textDomain;
55
  global $language;
91
  global $language;
56
92
-
 
93
  if ($lang === null)
-
 
94
  {
-
 
95
    $lang = $language;
-
 
96
  }
-
 
97
57
  /* DEBUG */
98
  /* DEBUG */
58
//   echo "return \$translator->translate(\"$s\", \"$textDomain\", \"$language\");<br>\n";
99
//   echo "return \$translator->translate(\"$s\", \"$textDomain\", \"$language\");<br>\n";
59
100
60
  return $translator->translate($s, $textDomain, $language);
101
  return $translator->translate($s, $textDomain, $lang);
61
}
102
}
62
103
63
$menu = array(
104
$menu = array(
64
  'scripts'   => array('path' => 'scripts/', 'text' => 'Scripting'),
105
  'scripts'   => array('path' => 'scripts/', 'text' => tr('Scripting')),
65
  'es-matrix' => array(
106
  'es-matrix' => array(
66
    'path'  => 'es-matrix',
107
    'path'  => 'es-matrix',
67
    'text'  => 'ES Matrix',
108
    'text'  => 'ES Matrix',
68
    'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")
109
    'title' => 'ECMAScript Support Matrix: ' . tr("A comparison of features of ECMAScript implementations")
69
  ),
110
  ),
70
  'devel'     => array('path' => 'websvn/',   'text' => tr('Software projects')),
111
  'devel'     => array('path' => 'wsvn/',   'text' => tr('Software projects')),
71
  'series'    => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),
112
  'series'    => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'),
72
  'ufpdb'     => array(
113
  'ufpdb'     => array(
73
    'path'  => "ufpdb/index.$language",
114
    'path'  => "ufpdb/index.$language",
74
    'text'  => 'UFPDB',
115
    'text'  => 'UFPDB',
75
    'title' => tr('United Federation of Planets DataBase')
116
    'title' => tr('United Federation of Planets DataBase')