I currently have:

public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
      $translate = new Zend_Translate('csv', 'languages', 'browser',
array('scan'=>Zend_Translate::LOCALE_DIRECTORY));
      $translate->setLocale('browser');
      Zend_Registry::set('Zend_Translate', $translate);
}

If I don't use $translate->setLocale('browser'); 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:

/languages
  -->en
    -->lang.en
  -->de
    -->lang.de
  -->fr
    -->lang.fr

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.

3) If I cache the language files using:

    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $frontendOptions = array('lifetime' => 7200);
        $backendOptions = array('cache_dir' =>
Zend_Registry::get('config')->general->sessionSavePath);
        $cache = Zend_Cache::factory('Page', 'File', $frontendOptions,
$backendOptions);
        Zend_Translate::setCache($cache);
        
        $options = array('scan' => Zend_Translate::LOCALE_DIRECTORY);
        
        $translate = new Zend_Translate('csv', 'languages', null, $options);
                
        Zend_Registry::set('Zend_Translate', $translate);
    }

Once the cache has expired I will always get the last language loaded
displayed until I refresh again i.e. it is not picking up the browser
locale.

Many thanks,

- Robert


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

Reply via email to