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