Robert,

as I already said within the issue you opened you must use 'auto' when you use directory scanning instead of 'browser'.
For 2) I gave you already the solution
And 3) can not work... you are using different options in your example code 1 and 3 because you set no language to use, so it uses always the last found.

Please do not re-ask already answered questions ;-)

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message ----- From: "Robert Castley" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Saturday, March 22, 2008 11:14 PM
Subject: [fw-general] Zend_Locale and browser detection question (ZF 1.5)


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