From 88f96187c3782f2359ff9f557b64549d63a360dc Mon Sep 17 00:00:00 2001 From: Evan Coury Date: Thu, 5 Jul 2012 19:40:41 -0700 Subject: [PATCH] Initial translation setup --- module/Application/Module.php | 1 + module/Application/config/module.config.php | 15 +++ module/Application/language/de_DE.mo | Bin 0 -> 534 bytes module/Application/language/de_DE.po | 140 ++++++++++++++++++++ module/Application/language/en_US.mo | Bin 0 -> 545 bytes module/Application/language/en_US.po | 140 ++++++++++++++++++++ .../Application/view/application/index/index.phtml | 37 +++--- module/Application/view/error/404.phtml | 22 +-- module/Application/view/error/index.phtml | 20 +-- 9 files changed, 336 insertions(+), 39 deletions(-) create mode 100644 module/Application/language/de_DE.mo create mode 100644 module/Application/language/de_DE.po create mode 100644 module/Application/language/en_US.mo create mode 100644 module/Application/language/en_US.po diff --git a/module/Application/Module.php b/module/Application/Module.php index 2cc8fdb..3a33540 100644 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -8,6 +8,7 @@ class Module { public function onBootstrap($e) { + $e->getApplication()->getServiceManager()->get('translator'); $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php index cdda3bd..124e37c 100644 --- a/module/Application/config/module.config.php +++ b/module/Application/config/module.config.php @@ -44,6 +44,21 @@ return array( ), ), ), + 'service_manager' => array( + 'factories' => array( + 'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory', + ), + ), + 'translator' => array( + 'locale' => 'en_US', + 'translation_patterns' => array( + array( + 'type' => 'gettext', + 'base_dir' => __DIR__ . '/../language', + 'pattern' => '%s.mo', + ), + ), + ), 'controllers' => array( 'invokables' => array( 'Application\Controller\Index' => 'Application\Controller\IndexController' diff --git a/module/Application/language/de_DE.mo b/module/Application/language/de_DE.mo new file mode 100644 index 0000000000000000000000000000000000000000..8da163864ae82bc9e40410e20a6eb1c480b94f32 GIT binary patch literal 534 zcmaJ-!A`s@jAPB0F?en%|me^^CEFQ3Cgu0*x}U)`7+3z6p1WZWw4vtY#~8>mvRSvSWXQX5yD8>{@>8FQJIJVl6*=VW|H zQfalAmo#ixce8*5SC+`$hC=-vBLCqi4C>rX*K?|Ql;mMuP#BAE_OQsfkf$tOa&6F_ z-9sO@{GZx0u!tZEU3;Nt(!R^v#ZvFTZ l%x71qb1rL!{(=&&i3q0Q#m!^Q%#iDNIiXeH(K6R*d;xW;pt}G7 literal 0 HcmV?d00001 diff --git a/module/Application/language/de_DE.po b/module/Application/language/de_DE.po new file mode 100644 index 0000000..64817a3 --- /dev/null +++ b/module/Application/language/de_DE.po @@ -0,0 +1,140 @@ +msgid "" +msgstr "" +"Project-Id-Version: ZendSkeletonModule\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-07-05 19:39-0700\n" +"PO-Revision-Date: 2012-07-05 19:39-0700\n" +"Last-Translator: Evan Coury \n" +"Language-Team: ZF Contributors \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: translate\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-Language: German\n" +"X-Poedit-Country: GERMANY\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../view/application/index/index.phtml:2 +#, php-format +msgid "Welcome to %sZend Framework 2%s" +msgstr "" + +#: ../view/application/index/index.phtml:3 +#, php-format +msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2." +msgstr "" + +#: ../view/application/index/index.phtml:4 +msgid "Fork Zend Framework 2 on GitHub" +msgstr "" + +#: ../view/application/index/index.phtml:10 +msgid "Follow Development" +msgstr "" + +#: ../view/application/index/index.phtml:11 +#, php-format +msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework webiste which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!" +msgstr "" + +#: ../view/application/index/index.phtml:12 +msgid "ZF2 Development Portal" +msgstr "" + +#: ../view/application/index/index.phtml:16 +msgid "Discover Modules" +msgstr "" + +#: ../view/application/index/index.phtml:17 +#, php-format +msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2." +msgstr "" + +#: ../view/application/index/index.phtml:18 +msgid "Explore ZF2 Modules" +msgstr "" + +#: ../view/application/index/index.phtml:22 +msgid "Help & Support" +msgstr "" + +#: ../view/application/index/index.phtml:23 +#, php-format +msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk.2 on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s." +msgstr "" + +#: ../view/application/index/index.phtml:24 +msgid "Ping us on IRC" +msgstr "" + +#: ../view/error/index.phtml:1 +msgid "An error occurred" +msgstr "" + +#: ../view/error/index.phtml:8 +msgid "Additional information" +msgstr "" + +#: ../view/error/index.phtml:11 +#: ../view/error/index.phtml:35 +msgid "File" +msgstr "" + +#: ../view/error/index.phtml:15 +#: ../view/error/index.phtml:39 +msgid "Message" +msgstr "" + +#: ../view/error/index.phtml:19 +#: ../view/error/index.phtml:43 +#: ../view/error/404.phtml:55 +msgid "Stack trace" +msgstr "" + +#: ../view/error/index.phtml:29 +msgid "Previous exceptions" +msgstr "" + +#: ../view/error/index.phtml:58 +msgid "No Exception available" +msgstr "" + +#: ../view/error/404.phtml:1 +msgid "A 404 error occurred" +msgstr "" + +#: ../view/error/404.phtml:10 +msgid "The requested controller was unable to dispatch the request." +msgstr "" + +#: ../view/error/404.phtml:13 +msgid "The requested controller could not be mapped to an existing controller class." +msgstr "" + +#: ../view/error/404.phtml:16 +msgid "The requested controller was not dispatchable." +msgstr "" + +#: ../view/error/404.phtml:19 +msgid "The requested URL could not be matched by routing." +msgstr "" + +#: ../view/error/404.phtml:22 +msgid "We cannot determine at this time why a 404 was generated." +msgstr "" + +#: ../view/error/404.phtml:34 +msgid "Controller" +msgstr "" + +#: ../view/error/404.phtml:41 +#, php-format +msgid "resolves to %s" +msgstr "" + +#: ../view/error/404.phtml:51 +msgid "Exception" +msgstr "" + diff --git a/module/Application/language/en_US.mo b/module/Application/language/en_US.mo new file mode 100644 index 0000000000000000000000000000000000000000..eab84673022572da30485c8abf697a7e4adb4b21 GIT binary patch literal 545 zcmZus%TB{E5G;aIj+{C8z>y6p2oXX-Z6Qb%EmSl`h?|>iQ$uP;_O?*|gWu!IZ?NGN zA+gfP-kn){=52H1wZXN<*kWum))_mDszSy)lSh13n%^2)^MENqFN0gOP8l7Ed(_$J z5ep=vJ7rm@R1y>34VK0d3|y`<=q_>xiHU?ayiVZE;-?1AC1E7?g619shY%cy=25gC z@I44v2sgM?)hGY!!Y^H4I)cPX?Fvc8Mj~EHEzZosu0(5&ZR9qsIzKh@Q?D;|zK}UW zf^yF8FIcKcO%}ZCMC)Y=87_&r_6rC5yTkSey+K@OZ~B2(t)pfOtCF)2KGSYlNTrWO zI+NBRos5$U2y0zsb&3{Zwv{QJM+wcsZLN7Z?u u+^nWJwkErZ#Q3V0#OGp^bdq>f^Ihq%lr)QkUk^tpZ8{tB7y>4IukisXb)<3t literal 0 HcmV?d00001 diff --git a/module/Application/language/en_US.po b/module/Application/language/en_US.po new file mode 100644 index 0000000..84f4dea --- /dev/null +++ b/module/Application/language/en_US.po @@ -0,0 +1,140 @@ +msgid "" +msgstr "" +"Project-Id-Version: ZendSkeletonApplication\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-07-05 19:30-0700\n" +"PO-Revision-Date: 2012-07-05 19:38-0700\n" +"Last-Translator: Evan Coury \n" +"Language-Team: ZF Contibutors \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-KeywordsList: translate\n" +"X-Poedit-Language: English\n" +"X-Poedit-Country: UNITED STATES\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SearchPath-0: ..\n" + +#: ../view/application/index/index.phtml:2 +#, php-format +msgid "Welcome to %sZend Framework 2%s" +msgstr "" + +#: ../view/application/index/index.phtml:3 +#, php-format +msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2." +msgstr "" + +#: ../view/application/index/index.phtml:4 +msgid "Fork Zend Framework 2 on GitHub" +msgstr "" + +#: ../view/application/index/index.phtml:10 +msgid "Follow Development" +msgstr "" + +#: ../view/application/index/index.phtml:11 +#, php-format +msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework webiste which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!" +msgstr "" + +#: ../view/application/index/index.phtml:12 +msgid "ZF2 Development Portal" +msgstr "" + +#: ../view/application/index/index.phtml:16 +msgid "Discover Modules" +msgstr "" + +#: ../view/application/index/index.phtml:17 +#, php-format +msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2." +msgstr "" + +#: ../view/application/index/index.phtml:18 +msgid "Explore ZF2 Modules" +msgstr "" + +#: ../view/application/index/index.phtml:22 +msgid "Help & Support" +msgstr "" + +#: ../view/application/index/index.phtml:23 +#, php-format +msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk.2 on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s." +msgstr "" + +#: ../view/application/index/index.phtml:24 +msgid "Ping us on IRC" +msgstr "" + +#: ../view/error/index.phtml:1 +msgid "An error occurred" +msgstr "" + +#: ../view/error/index.phtml:8 +msgid "Additional information" +msgstr "" + +#: ../view/error/index.phtml:11 +#: ../view/error/index.phtml:35 +msgid "File" +msgstr "" + +#: ../view/error/index.phtml:15 +#: ../view/error/index.phtml:39 +msgid "Message" +msgstr "" + +#: ../view/error/index.phtml:19 +#: ../view/error/index.phtml:43 +#: ../view/error/404.phtml:55 +msgid "Stack trace" +msgstr "" + +#: ../view/error/index.phtml:29 +msgid "Previous exceptions" +msgstr "" + +#: ../view/error/index.phtml:58 +msgid "No Exception available" +msgstr "" + +#: ../view/error/404.phtml:1 +msgid "A 404 error occurred" +msgstr "" + +#: ../view/error/404.phtml:10 +msgid "The requested controller was unable to dispatch the request." +msgstr "" + +#: ../view/error/404.phtml:13 +msgid "The requested controller could not be mapped to an existing controller class." +msgstr "" + +#: ../view/error/404.phtml:16 +msgid "The requested controller was not dispatchable." +msgstr "" + +#: ../view/error/404.phtml:19 +msgid "The requested URL could not be matched by routing." +msgstr "" + +#: ../view/error/404.phtml:22 +msgid "We cannot determine at this time why a 404 was generated." +msgstr "" + +#: ../view/error/404.phtml:34 +msgid "Controller" +msgstr "" + +#: ../view/error/404.phtml:41 +#, php-format +msgid "resolves to %s" +msgstr "" + +#: ../view/error/404.phtml:51 +msgid "Exception" +msgstr "" + diff --git a/module/Application/view/application/index/index.phtml b/module/Application/view/application/index/index.phtml index c9ba100..b86c138 100644 --- a/module/Application/view/application/index/index.phtml +++ b/module/Application/view/application/index/index.phtml @@ -1,25 +1,26 @@ -
-

Welcome to Zend Framework 2

-

Congratulations! You have successfully installed the ZF2 Skeleton Application. You are currently running Zend Framework version . This skeleton can serve as a simple starting point for you to begin building your application on ZF2.

-

Fork Zend Framework 2 on GitHub »

-
+
+

translate('Welcome to %sZend Framework 2%s'), '', '') ?>

+

translate('Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.'), '', '', \Zend\Version::VERSION) ?>

+

translate('Fork Zend Framework 2 on GitHub') ?> »

+
-
-
-

Follow Development

-

Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework webiste which provides links to the ZF2 wiki, dev blog, issue tracker, and much more. This is a great resource for staying up to date with the latest developments!

-

ZF2 Development Portal »

+
+
+

translate('Follow Development') ?>

+

translate('Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework webiste which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!'), '', '', '', '', '', '') ?>

+

translate('ZF2 Development Portal') ?> »

+
-

Discover Modules

-

The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available on GitHub. The site is currently live and currently contains a list of some of the modules already available for ZF2.

-

Explore ZF2 Modules »

+

translate('Discover Modules') ?>

+

translate('The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.'), '', '') ?>

+

translate('Explore ZF2 Modules') ?> »

-
-

Help & Support

-

If you need any help or support while developing with ZF2, you may reach us via IRC: #zftalk.2 on Freenode. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the mailing lists.

-

Ping us on IRC »

+
+

translate('Help & Support') ?>

+

translate('If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk.2 on Freenode%s. We\'d love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.'), '', '', '', '') ?>

+

translate('Ping us on IRC') ?> »

-
+
diff --git a/module/Application/view/error/404.phtml b/module/Application/view/error/404.phtml index 58be921..3edd37a 100644 --- a/module/Application/view/error/404.phtml +++ b/module/Application/view/error/404.phtml @@ -1,4 +1,4 @@ -

A 404 error occurred

+

translate('A 404 error occurred') ?>

message ?>

reason) && $this->reason): ?> @@ -7,19 +7,19 @@ $reasonMessage= ''; switch ($this->reason) { case 'error-controller-cannot-dispatch': - $reasonMessage = 'The requested controller was unable to dispatch the request.'; + $reasonMessage = $this->translate('The requested controller was unable to dispatch the request.'); break; case 'error-controller-not-found': - $reasonMessage = 'The requested controller could not be mapped to an existing controller class.'; + $reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.'); break; case 'error-controller-invalid': - $reasonMessage = 'The requested controller was not dispatchable.'; + $reasonMessage = $this->translate('The requested controller was not dispatchable.'); break; case 'error-router-no-match': - $reasonMessage = 'The requested URL could not be matched by routing.'; + $reasonMessage = $this->translate('The requested URL could not be matched by routing.'); break; default: - $reasonMessage = 'We cannot determine at this time why a 404 was generated.'; + $reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.'); break; } ?> @@ -31,14 +31,14 @@ switch ($this->reason) { controller) && $this->controller): ?>
-
Controller:
+
translate('Controller') ?>:
escapeHtml($this->controller) ?> controller_class) +if (isset($this->controller_class) && $this->controller_class && $this->controller_class != $this->controller ) { - echo " (resolves to " . $this->escapeHtml($this->controller_class) . ")"; + echo '(' . sprintf($this->translate('resolves to %s'), $this->escapeHtml($this->controller_class)) . ')'; } ?>
@@ -48,11 +48,11 @@ if (isset($this->controller_class) exception) && $this->exception): ?> -

Exception:

+

translate('Exception') ?>:

escapeHtml($this->exception->getMessage()) ?>

-

Stack trace

+

translate('Stack trace') ?>:

 exception->getTraceAsString() ?>
diff --git a/module/Application/view/error/index.phtml b/module/Application/view/error/index.phtml
index ab9bf9b..ced65de 100644
--- a/module/Application/view/error/index.phtml
+++ b/module/Application/view/error/index.phtml
@@ -1,22 +1,22 @@
-

An error occurred

+

translate('An error occurred') ?>

message ?>

display_exceptions) && $this->display_exceptions): ?> exception) && $this->exception instanceof Exception): ?>
-

Additional information:

+

translate('Additional information') ?>:

exception); ?>

-
File:
+
translate('File') ?>:
exception->getFile() ?>:exception->getLine() ?>
-
Message:
+
translate('Message') ?>:
exception->getMessage() ?>
-
Stack trace:
+
translate('Stack trace') ?>:
exception->getTraceAsString() ?>
@@ -26,21 +26,21 @@ if ($e) : ?>
-

Previous exceptions:

+

translate('Previous exceptions') ?>:

  • -
    File:
    +
    translate('File') ?>:
    getFile() ?>:getLine() ?>
    -
    Message:
    +
    translate('Message') ?>:
    getMessage() ?>
    -
    Stack trace:
    +
    translate('Stack trace') ?>:
    getTraceAsString() ?>
    @@ -55,7 +55,7 @@ -

    No Exception available

    +

    translate('No Exception available') ?>

    -- 1.7.10.4