Rev 140 | Rev 152 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 140 | Rev 141 | ||
---|---|---|---|
Line 27... | Line 27... | ||
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 | bindtextdomain($textDomain, $baseDir); |
- | |
33 | 32 | ||
34 | /* Choose domain */
|
- | |
35 | textdomain($textDomain); |
33 | if (function_exists('_')) |
36 | 34 | {
|
|
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;
|
35 | bindtextdomain($textDomain, $baseDir); |
52 | // $translator = new Translator();
|
- | |
53 | // $type = 'gettext';
|
- | |
54 | // $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';
|
- | |
55 | // $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain);
|
- | |
56 | 36 | ||
- | 37 | /* Choose domain */
|
|
- | 38 | /* Translation is looking for in ./LocaleData/de/LC_MESSAGES/de.pointedears.mo now */
|
|
57 | if (!function_exists('_')) |
39 | textdomain($textDomain); |
- | 40 | }
|
|
- | 41 | else
|
|
58 | {
|
42 | {
|
- | 43 | /* TODO: Use Autoloader */
|
|
- | 44 | require_once 'Zend\Stdlib\ErrorHandler.php'; |
|
- | 45 | require_once 'Zend\I18n\Translator\TextDomain.php'; |
|
- | 46 | require_once 'Zend\I18n\Translator\Loader\FileLoaderInterface.php'; |
|
- | 47 | require_once 'Zend\I18n\Translator\Loader\Gettext.php'; |
|
- | 48 | require_once 'Zend\ServiceManager\ServiceLocatorAwareInterface.php'; |
|
- | 49 | require_once 'Zend\ServiceManager\ServiceLocatorInterface.php'; |
|
- | 50 | require_once 'Zend\ServiceManager\ServiceManager.php'; |
|
- | 51 | require_once 'Zend\ServiceManager\AbstractPluginManager.php'; |
|
- | 52 | require_once 'Zend\I18n\Translator\LoaderPluginManager.php'; |
|
- | 53 | require_once 'Zend\I18n\Translator\Translator.php'; |
|
- | 54 | ||
- | 55 | $translator = new Zend\I18n\Translator\Translator(); |
|
- | 56 | $type = 'gettext'; |
|
- | 57 | $pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo'; |
|
- | 58 | $translator->addTranslationFilePattern($type, $baseDir, $pattern, $textDomain); |
|
- | 59 | ||
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); |
- | 69 | }
|
|
- | 70 | ||
- | 71 | return $s; |
|
66 | }
|
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'), |