Rev 189 | Rev 210 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 189 | Rev 191 | ||
|---|---|---|---|
| Line 23... | Line 23... | ||
| 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 | $languages = array( |
26 | $languages = array( |
| 27 | 'en' => 'English', |
27 | 'en' => 'English', |
| 28 | 'de' => 'Deutsch' |
28 | 'de' => 'Deutsch', |
| - | 29 | // 'ru' => 'По-русски',
|
|
| 29 | ); |
30 | ); |
| 30 | 31 | ||
| 31 | require_once 'Zend/Loader/StandardAutoloader.php'; |
32 | require_once 'Zend/Loader/StandardAutoloader.php'; |
| 32 | $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true)); |
33 | $loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true)); |
| 33 | $loader->register(); |
34 | $loader->register(); |
| 34 | 35 | ||
| 35 | $translator = new Zend\I18n\Translator\Translator(); |
36 | $translator = new Zend\I18n\Translator\Translator(); |
| 36 | // $translator->setCache(new Zend\Cache\Storage\*Adapter());
|
37 | // $translator->setCache(new Zend\Cache\Storage\*Adapter());
|
| 37 | $type = 'gettext'; |
38 | $type = 'gettext'; |
| 38 | $baseDir = './i18n/LocaleData'; |
39 | $baseDir = './i18n/LocaleData'; |
| 39 | $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo'; |
- | |
| 40 | $textDomain = 'de.pointedears'; |
40 | $textDomain = 'de.pointedears'; |
| - | 41 | $pattern = "%s/LC_MESSAGES/{$textDomain}.mo"; |
|
| 41 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain); |
42 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain); |
| 42 | 43 | ||
| 43 | /**
|
44 | /**
|
| 44 | * Returns the translation of the parameter, if any,
|
45 | * Returns the translation of the parameter, if any,
|
| 45 | * using Zend Framework 2.1 Translate
|
46 | * using Zend Framework 2.1 Translate
|
| Line 51... | Line 52... | ||
| 51 | {
|
52 | {
|
| 52 | global $translator; |
53 | global $translator; |
| 53 | global $textDomain; |
54 | global $textDomain; |
| 54 | global $language; |
55 | global $language; |
| 55 | 56 | ||
| - | 57 | /* DEBUG */
|
|
| - | 58 | // echo "return \$translator->translate(\"$s\", \"$textDomain\", \"$language\");<br>\n";
|
|
| - | 59 | ||
| 56 | return $translator->translate($s, $textDomain, $language); |
60 | return $translator->translate($s, $textDomain, $language); |
| 57 | }
|
61 | }
|
| 58 | 62 | ||
| 59 | $menu = array( |
63 | $menu = array( |
| 60 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), |
64 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), |