ZF-2920: Zend_Translate will not downgrade to English if locale set is not available

Issue Type: Bug Created: 2008-03-19T04:30:40.000+0000 Last Updated: 2008-03-21T17:09:04.000+0000 Status: Resolved Fix version(s): - 1.5.1 (25/Mar/08)

Reporter: Robert Castley (rcastley) Assignee: Thomas Weidner (thomas) Tags: Related issues: Attachments:


This is in repsect to ZF-2908

I have made the suggested changes to my code. I know have:

<pre class="highlight">
public function preDispatch(Zend_Controller_Request_Abstract $request)
      $locale = new Zend_Locale();
      $translate = new Zend_Translate('csv', 'languages', 'browser', array('scan'=>Zend_Translate::LOCALE_DIRECTORY));
      Zend_Registry::set('Zend_Translate', $translate);

If I don't use:

<pre class="highlight">

it seems to display the values of the last language file loaded.

A couple of things to note:

  1. My language files are stored like so:

  2. If I set my browser to e.g. Cambodian(km) I will only see messageIds in my view. How do I get this to default or downgrade to English. In 1.0.4 using the addTranslation it use to downgrade through the available languages sent by the browser i.e. if I had km -> es -> en in my list it would display English if I did not have km and es translations available.

Also, Zend_Translate is not available Zend_View_Helper_MyHelper via $this->translate, I get an undefined method. The docs seem to say that you can use $this->translate in helpers as long as you store $translate in the registry key Zend_Translate which I have done. $this->translate is available in script views i.e. index.phtml.

Sorry to be a pain!


Posted by Thomas Weidner (thomas) on 2008-03-19T11:04:11.000+0000

Duplicate of ZF-2919

Posted by Wil Sinclair (wil) on 2008-03-21T17:09:04.000+0000

I'm assuming this fix is merged to the 1.5 release branch for release with 1.5.1. Please update JIRA if this is not the case.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.