Rev 117 | Rev 140 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 117 | Rev 137 | ||
|---|---|---|---|
| Line 25... | Line 25... | ||
| 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'; | |
| - | 31 | $baseDir = './LocaleData'; | |
| 30 | bindtextdomain("de.pointedears", "./LocaleData"); | 32 | // bindtextdomain($textdomain, $baseDir);
 | 
| 31 | 33 | ||
| 32 | /* Choose domain */
 | 34 | /* Choose domain */
 | 
| 33 | textdomain("de.pointedears"); | 35 | // textdomain("de.pointedears");
 | 
| 34 | 36 | ||
| 35 | /* Translation is looking for in ./LocaleData/de_DE/LC_MESSAGES/de.pointedears.mo now */
 | 37 | /* Translation is looking for in ./LocaleData/de/LC_MESSAGES/de.pointedears.mo now */
 | 
| - | 38 | ||
| - | 39 | /* TODO: Use Autoloader */
 | |
| - | 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); | |
| - | 56 | ||
| - | 57 | function _($s) | |
| - | 58 | {
 | |
| - | 59 | global $translator; | |
| - | 60 | global $textDomain; | |
| - | 61 | global $language; | |
| - | 62 | ||
| - | 63 | return $translator->translate($s, $textDomain, $language); | |
| - | 64 | }
 | |
| 36 | 65 | ||
| 37 | $menu = array( | 66 | $menu = array( | 
| 38 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), | 67 | 'scripts' => array('path' => 'scripts/', 'text' => 'Scripting'), | 
| 39 | 'es-matrix' => array( | 68 | 'es-matrix' => array( | 
| 40 | 'path' => 'es-matrix', | 69 | 'path' => 'es-matrix', |