Initial translation setup
authorEvan Coury <me@evancoury.com>
Fri, 6 Jul 2012 02:40:41 +0000 (19:40 -0700)
committerEvan Coury <me@evancoury.com>
Fri, 6 Jul 2012 02:40:41 +0000 (19:40 -0700)
module/Application/Module.php
module/Application/config/module.config.php
module/Application/language/de_DE.mo [new file with mode: 0644]
module/Application/language/de_DE.po [new file with mode: 0644]
module/Application/language/en_US.mo [new file with mode: 0644]
module/Application/language/en_US.po [new file with mode: 0644]
module/Application/view/application/index/index.phtml
module/Application/view/error/404.phtml
module/Application/view/error/index.phtml

index 2cc8fdb..3a33540 100644 (file)
@@ -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);
index cdda3bd..124e37c 100644 (file)
@@ -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 (file)
index 0000000..8da1638
Binary files /dev/null and b/module/Application/language/de_DE.mo differ
diff --git a/module/Application/language/de_DE.po b/module/Application/language/de_DE.po
new file mode 100644 (file)
index 0000000..64817a3
--- /dev/null
@@ -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 <me@evancoury.com>\n"
+"Language-Team: ZF Contributors <zf-devteam@zend.com>\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 &amp; 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 (file)
index 0000000..eab8467
Binary files /dev/null and b/module/Application/language/en_US.mo differ
diff --git a/module/Application/language/en_US.po b/module/Application/language/en_US.po
new file mode 100644 (file)
index 0000000..84f4dea
--- /dev/null
@@ -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 <me@evancoury.com>\n"
+"Language-Team: ZF Contibutors <zf-devteam@zend.com>\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 &amp; 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 ""
+
index c9ba100..b86c138 100644 (file)
@@ -1,25 +1,26 @@
-  <div class="hero-unit">
-    <h1>Welcome to <span class="zf-green">Zend Framework 2</span></h1>
-    <p>Congratulations! You have successfully installed the <a href="https://github.com/zendframework/ZendSkeletonApplication" target="_blank">ZF2 Skeleton Application</a>. You are currently running Zend Framework version <?php echo \Zend\Version::VERSION ?>. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.</p>
-    <p><a class="btn btn-success btn-large" href="https://github.com/zendframework/zf2" target="_blank">Fork Zend Framework 2 on GitHub &raquo;</a></p>
-  </div>
+<div class="hero-unit">
+    <h1><?php echo sprintf($this->translate('Welcome to %sZend Framework 2%s'), '<span class="zf-green">', '</span>') ?></h1>
+    <p><?php echo sprintf($this->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.'), '<a href="https://github.com/zendframework/ZendSkeletonApplication" target="_blank">', '</a>', \Zend\Version::VERSION) ?></p>
+    <p><a class="btn btn-success btn-large" href="https://github.com/zendframework/zf2" target="_blank"><?php echo $this->translate('Fork Zend Framework 2 on GitHub') ?> &raquo;</a></p>
+</div>
 
-  <div class="row">
-    <div class="span4">
-      <h2>Follow Development</h2>
-        <p>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 <a href="http://framework.zend.com/wiki/display/ZFDEV2/Home">wiki</a>, <a href="http://framework.zend.com/zf2/blog">dev blog</a>, <a href="http://framework.zend.com/issues/browse/ZF2">issue tracker</a>, and much more. This is a great resource for staying up to date with the latest developments!</p>
-      <p><a class="btn btn-success" href="http://framework.zend.com/zf2" target="_blank">ZF2 Development Portal &raquo;</a></p>
+<div class="row">
 
+    <div class="span4">
+        <h2><?php echo $this->translate('Follow Development') ?></h2>
+        <p><?php echo sprintf($this->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!'), '<a href="http://framework.zend.com/wiki/display/ZFDEV2/Home">', '</a>', '<a href="http://framework.zend.com/zf2/blog">', '</a>', '<a href="http://framework.zend.com/issues/browse/ZF2">', '</a>') ?></p>
+        <p><a class="btn btn-success" href="http://framework.zend.com/zf2" target="_blank"><?php echo $this->translate('ZF2 Development Portal') ?> &raquo;</a></p>
     </div>
+
     <div class="span4">
-      <h2>Discover Modules</h2>
-       <p>The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available <a href="https://github.com/zendframework/modules.zendframework.com">on GitHub</a>. The site is currently live and currently contains a list of some of the modules already available for ZF2.</p>
-      <p><a class="btn btn-success" href="http://modules.zendframework.com/" target="_blank">Explore ZF2 Modules &raquo;</a></p>
+        <h2><?php echo $this->translate('Discover Modules') ?></h2>
+        <p><?php echo sprintf($this->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.'), '<a href="https://github.com/zendframework/modules.zendframework.com">', '</a>') ?></p>
+        <p><a class="btn btn-success" href="http://modules.zendframework.com/" target="_blank"><?php echo $this->translate('Explore ZF2 Modules') ?> &raquo;</a></p>
    </div>
-   <div class="span4">
 
-     <h2>Help &amp; Support</h2>
-     <p>If you need any help or support while developing with ZF2, you may reach us via IRC: <a href="irc://irc.freenode.net/zftalk.2">#zftalk.2 on Freenode</a>. 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 <a href="http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists">mailing lists</a>.</p>
-     <p><a class="btn btn-success" href="http://webchat.freenode.net?channels=zftalk.2" target="_blank">Ping us on IRC &raquo;</a></p>
+   <div class="span4">
+       <h2><?php echo $this->translate('Help &amp; Support') ?></h2>
+       <p><?php echo sprintf($this->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.'), '<a href="irc://irc.freenode.net/zftalk.2">', '</a>', '<a href="http://framework.zend.com/wiki/display/ZFDEV/Mailing+Lists">', '</a>') ?></p>
+       <p><a class="btn btn-success" href="http://webchat.freenode.net?channels=zftalk.2" target="_blank"><?php echo $this->translate('Ping us on IRC') ?> &raquo;</a></p>
    </div>
-  </div>
+</div>
index 58be921..3edd37a 100644 (file)
@@ -1,4 +1,4 @@
-<h1>A 404 error occurred</h1>
+<h1><?php echo $this->translate('A 404 error occurred') ?></h1>
 <h2><?php echo $this->message ?></h2>
 
 <?php if (isset($this->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) {
 <?php if (isset($this->controller) && $this->controller): ?>
 
 <dl>
-    <dt>Controller:</dt>
+    <dt><?php echo $this->translate('Controller') ?>:</dt>
     <dd><?php echo $this->escapeHtml($this->controller) ?>
 <?php
-if (isset($this->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)) . ')';
 }
 ?>
 </dd>
@@ -48,11 +48,11 @@ if (isset($this->controller_class)
 
 <?php if (isset($this->exception) && $this->exception): ?>
 
-<h2>Exception:</h2>
+<h2><?php echo $this->translate('Exception') ?>:</h2>
 
 <p><b><?php echo $this->escapeHtml($this->exception->getMessage()) ?></b></p>
 
-<h3>Stack trace</h3>
+<h3><?php echo $this->translate('Stack trace') ?>:</h3>
 
 <pre>
 <?php echo $this->exception->getTraceAsString() ?>
index ab9bf9b..ced65de 100644 (file)
@@ -1,22 +1,22 @@
-<h1>An error occurred</h1>
+<h1><?php echo $this->translate('An error occurred') ?></h1>
 <h2><?php echo $this->message ?></h2>
 
 <?php if (isset($this->display_exceptions) && $this->display_exceptions): ?>
 
 <?php if(isset($this->exception) && $this->exception instanceof Exception): ?>
 <hr/>
-<h2>Additional information:</h2>
+<h2><?php echo $this->translate('Additional information') ?>:</h2>
 <h3><?php echo get_class($this->exception); ?></h3>
 <dl>
-    <dt>File:</dt>
+    <dt><?php echo $this->translate('File') ?>:</dt>
     <dd>
         <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
     </dd>
-    <dt>Message:</dt>
+    <dt><?php echo $this->translate('Message') ?>:</dt>
     <dd>
         <pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
     </dd>
-    <dt>Stack trace:</dt>
+    <dt><?php echo $this->translate('Stack trace') ?>:</dt>
     <dd>
         <pre class="prettyprint linenums"><?php echo $this->exception->getTraceAsString() ?></pre>
     </dd>
     if ($e) :
 ?>
 <hr/>
-<h2>Previous exceptions:</h2>
+<h2><?php echo $this->translate('Previous exceptions') ?>:</h2>
 <ul class="unstyled">
     <?php while($e) : ?>
     <li>
         <h3><?php echo get_class($e); ?></h3>
         <dl>
-            <dt>File:</dt>
+            <dt><?php echo $this->translate('File') ?>:</dt>
             <dd>
                 <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
             </dd>
-            <dt>Message:</dt>
+            <dt><?php echo $this->translate('Message') ?>:</dt>
             <dd>
                 <pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
             </dd>
-            <dt>Stack trace:</dt>
+            <dt><?php echo $this->translate('Stack trace') ?>:</dt>
             <dd>
                 <pre class="prettyprint linenums"><?php echo $e->getTraceAsString() ?></pre>
             </dd>
@@ -55,7 +55,7 @@
 
 <?php else: ?>
 
-<h3>No Exception available</h3>
+<h3><?php echo $this->translate('No Exception available') ?></h3>
 
 <?php endif ?>