Rev 140 | Rev 151 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 140 | Rev 141 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | $encoding = 'UTF-8'; |
3 | $encoding = 'UTF-8'; |
4 | header("Content-Type: text/html" . ($encoding ? "; charset=$encoding" : "")); |
4 | header("Content-Type: text/html" . ($encoding ? "; charset=$encoding" : "")); |
5 | 5 | ||
6 | $modi = max(array( |
6 | $modi = max(array( |
7 | @filemtime(__FILE__), |
7 | @filemtime(__FILE__), |
8 | @filemtime('LocaleData'), |
8 | @filemtime('LocaleData'), |
9 | @filemtime('index.phtml'), |
9 | @filemtime('index.phtml'), |
10 | @filemtime('styles/lcars-basic.css'), |
10 | @filemtime('styles/lcars-basic.css'), |
11 | @filemtime('styles/lcars22.css'), |
11 | @filemtime('styles/lcars22.css'), |
12 | @filemtime('styles/lcars-ani.css'), |
12 | @filemtime('styles/lcars-ani.css'), |
13 | @filemtime('scripts/object.js'), |
13 | @filemtime('scripts/object.js'), |
14 | )); |
14 | )); |
15 | 15 | ||
16 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT'); |
16 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $modi) . ' GMT'); |
17 | 17 | ||
18 | /* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */
|
18 | /* Cached resource expires in HTTP/1.1 caches 24h after last retrieval */
|
19 | header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate'); |
19 | header('Cache-Control: max-age=86400, s-maxage=86400, must-revalidate, proxy-revalidate'); |
20 | 20 | ||
21 | /* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
|
21 | /* Cached resource expires in HTTP/1.0 caches 24h after last retrieval */
|
22 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT'); |
22 | header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT'); |
23 | 23 | ||
24 | $languages = array( |
24 | $languages = array( |
25 | 'en' => 'English', |
25 | 'en' => 'English', |
26 | 'de' => 'Deutsch' |
26 | 'de' => 'Deutsch' |
27 | ); |
27 | ); |
28 | 28 | ||
29 | /* Specify location of translation tables */
|
29 | /* Specify location of translation tables */
|
30 | $textDomain = 'de.pointedears'; |
30 | $textDomain = 'de.pointedears'; |
31 | $baseDir = './LocaleData'; |
31 | $baseDir = './LocaleData'; |
- | 32 | ||
- | 33 | if (function_exists('_')) |
|
- | 34 | {
|
|
32 | bindtextdomain($textDomain, $baseDir); |
35 | bindtextdomain($textDomain, $baseDir); |
33 | 36 | ||
34 | /* Choose domain */
|
37 | /* Choose domain */
|
35 | textdomain($textDomain); |
- | |
36 | - | ||
37 | /* Translation is looking for in ./LocaleData/de/LC_MESSAGES/de.pointedears.mo now */
|
38 | /* Translation is looking for in ./LocaleData/de/LC_MESSAGES/de.pointedears.mo now */
|
- | 39 | textdomain($textDomain); |
|
- | 40 | }
|
|
- | 41 | else
|
|
38 | 42 | {
|
|
39 | /* TODO: Use Autoloader */
|
43 | /* TODO: Use Autoloader */
|
40 | // require_once 'Zend\Stdlib\ErrorHandler.php';
|
44 | require_once 'Zend\Stdlib\ErrorHandler.php'; |
41 | // require_once 'Zend\I18n\Translator\TextDomain.php';
|
45 | require_once 'Zend\I18n\Translator\TextDomain.php'; |
42 | // require_once 'Zend\I18n\Translator\Loader\FileLoaderInterface.php';
|
46 | require_once 'Zend\I18n\Translator\Loader\FileLoaderInterface.php'; |
43 | // require_once 'Zend\I18n\Translator\Loader\Gettext.php';
|
47 | require_once 'Zend\I18n\Translator\Loader\Gettext.php'; |
44 | // require_once 'Zend\ServiceManager\ServiceLocatorAwareInterface.php';
|
48 | require_once 'Zend\ServiceManager\ServiceLocatorAwareInterface.php'; |
45 | // require_once 'Zend\ServiceManager\ServiceLocatorInterface.php';
|
49 | require_once 'Zend\ServiceManager\ServiceLocatorInterface.php'; |
46 | // require_once 'Zend\ServiceManager\ServiceManager.php';
|
50 | require_once 'Zend\ServiceManager\ServiceManager.php'; |
47 | // require_once 'Zend\ServiceManager\AbstractPluginManager.php';
|
51 | require_once 'Zend\ServiceManager\AbstractPluginManager.php'; |
48 | // require_once 'Zend\I18n\Translator\LoaderPluginManager.php';
|
52 | require_once 'Zend\I18n\Translator\LoaderPluginManager.php'; |
49 | // require_once 'Zend\I18n\Translator\Translator.php';
|
53 | require_once 'Zend\I18n\Translator\Translator.php'; |
50 | //
|
54 | |
51 | // use Zend\I18n\Translator\Translator;
|
55 | $translator = new Zend\I18n\Translator\Translator(); |
52 | // $translator = new Translator();
|
- | |
53 | // $type = 'gettext';
|
56 | $type = 'gettext'; |
54 | // $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';
|
57 | $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo'; |
55 | // $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);
|
58 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain); |
56 | 59 | ||
57 | if (!function_exists('_')) |
- | |
58 | {
|
- | |
59 | function _($s) |
60 | function _($s) |
60 | {
|
61 | {
|
61 | global $translator; |
62 | global $translator; |
62 | global $textDomain; |
63 | global $textDomain; |
63 | global $language; |
64 | global $language; |
64 | 65 | ||
- | 66 | if ($translator) |
|
- | 67 | {
|
|
65 | return $translator->translate($s, $textDomain, $language); |
68 | return $translator->translate($s, $textDomain, $language); |
66 | }
|
69 | }
|
- | 70 | ||
- | 71 | return $s; |
|
- | 72 | }
|
|
67 | }
|
73 | }
|
68 | 74 | ||
69 | $menu = array( |
75 | $menu = array( |
70 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), |
76 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), |
71 | 'es-matrix' => array( |
77 | 'es-matrix' => array( |
72 | 'path' => 'es-matrix', |
78 | 'path' => 'es-matrix', |
73 | 'text' => 'ES Matrix', |
79 | 'text' => 'ES Matrix', |
74 | 'title' => 'ECMAScript Support Matrix: ' . _("A comparison of features of ECMAScript implementations") |
80 | 'title' => 'ECMAScript Support Matrix: ' . _("A comparison of features of ECMAScript implementations") |
75 | ), |
81 | ), |
76 | 'devel' => array('path' => 'devel/', 'text' => _('Other software')), |
82 | 'devel' => array('path' => 'devel/', 'text' => _('Other software')), |
77 | 'series' => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'), |
83 | 'series' => array('path' => "media/video/series/", 'text' => 'Seri-o-meter'), |
78 | 'ufpdb' => array( |
84 | 'ufpdb' => array( |
79 | 'path' => "ufpdb/index.$language", |
85 | 'path' => "ufpdb/index.$language", |
80 | 'text' => 'UFPDB', |
86 | 'text' => 'UFPDB', |
81 | 'title' => _('United Federation of Planets DataBase') |
87 | 'title' => _('United Federation of Planets DataBase') |
82 | )
|
88 | )
|
83 | ); |
89 | ); |
84 | 90 |