Hi, I am using exactly the same ZF application code on Linux & Windows.
If I run the following code (taken from the manual) on Windows: $locale = new Zend_Locale(); // Return all default locales $found = $locale->getDefault(); print_r($found); // Return only browser locales $found2 = $locale->getDefault(Zend_Locale::BROWSER,TRUE); print_r($found2); I get returned; Array ( [en] => 1 [de_AT] => 1 [de] => 1 [en_GB] => 0.3 ) Array ( [en] => 1 [de_AT] => 1 [de] => 1 [en_GB] => 0.3 ) If I run it on Unix I get returned: Array ( [de_AT] => 1 [de] => 1 [en_GB] => 0.3 [en] => 0.3 ) Array ( [de_AT] => 1 [de] => 1 [en_GB] => 0.3 [en] => 0.3 ) I am using the same browser to access both systems (FF 3 with languages set as Austrain, German, English). Now ... If I go and edit Zend/Locale.php and change: $languages = $this->getBrowser(); if ((empty($languages) === true) or ($fastsearch === false)) { $languages = $this->getEnvironment() + $languages; $languages = $this->getFramework() + $languages; } To this: $languages = $this->getBrowser(); if ((empty($languages) === true) or ($fastsearch === false)) { //$languages = $this->getEnvironment() + $languages; $languages = $this->getFramework() + $languages; } I get the following on Windows: Array ( [de_AT] => 1 [de] => 1 [en_GB] => 0.3 [en] => 0.3 ) Array ( [de_AT] => 1 [de] => 1 [en_GB] => 0.3 [en] => 0.3 ) Which is correct! Even if I use a: $locale->setLocale('browser'); It still does work as expected. It seems that somehow the Locale.php code is getting the browser settings but then appending the environment settings. - Robert -----Original Message----- From: Thomas Weidner [mailto:[EMAIL PROTECTED] Sent: 12 November 2008 14:56 To: fw-general@lists.zend.com Subject: Re: [fw-general] Problem with Zend_Locale, UTF-8, setLocale on Windows Eigher you use browser settings which means that you stick on HTTP_ACCEPT_LANGUAGE or you stick with environment, which means LC_ALL. The browser uses the locale 'browser' within Zend_Locale. Also Zend_Locale has no getList() method. As you mentioned "Registry Locale"... do you mean setting the Zend_Locale object to Zend_Registry with the key Zend_Locale ? This is named "Application wide locale" and available with 1.7. This will not work in 1.6.2. You can read about this here: http://framework.zend.com/manual/en/zend.translate.using.html#zend.translate .using.languages.automatic Greetings Thomas Weidner, I18N Team Leader, Zend Framework http://www.thomasweidner.com ----- Original Message ----- From: "Robert Castley" <[EMAIL PROTECTED]> To: <fw-general@lists.zend.com> Sent: Wednesday, November 12, 2008 3:34 PM Subject: [fw-general] Problem with Zend_Locale, UTF-8, setLocale on Windows > Hi, > > It seems that in 1.6.2 Zend_Locale doesn't handle well under Windows. > > Zend_Locale is using > > $language = setlocale(LC_ALL, 0); > > in the getEnvironment function > > Using the same browser to access two systems I get: > > On my Windows ZF system this will return: > Array > > ( > > [0] => LC_COLLATE=C > > [1] => LC_CTYPE=English_United Kingdom.1252 > > [2] => LC_MONETARY=C > > [3] => LC_NUMERIC=C > > [4] => LC_TIME=C > > ) > > > On my Linux ZF system this will return: > > Array > > ( > > [0] => C > > ) > > > Now running my language debugger I see the following: > > Windows System: > > > _SERVER["HTTP_ACCEPT_LANGUAGE"]=de-at,de;q=0.7,en-gb;q=0.3 > > > > Registry contains: > > Display getList(): > > Array > > ( > > [en] => en > > [de] => de > > [es] => es > > [fr] => fr > > [it] => it > > ) > > Translate save: Save > > Registry Locale: en > > > On Windows it is failing to detect the correct Browser Language setting. > > Using the same browser and pointing at a Linux system I get: > > > _SERVER["HTTP_ACCEPT_LANGUAGE"]=de-at,de;q=0.7,en-gb;q=0.3 > > > > Registry contains: > > Display getList(): > > Array > > ( > > [de] => de > > [en] => en > > [es] => es > > [fr] => fr > > [it] => it > > ) > > Translate save: Speichern > > Registry Locale: de > > > Which is correct! > > The only thing I could find on Google was this which handles setting the > character set for Linux and the codepage for Windows: > > https://code.zikula.org/svn/core/development/zikula-1/includes/pnLang.php > <https://code.zikula.org/svn/core/development/zikula-1/includes/pnLang.php> > > Look in the function pnSetLocale. > > - 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. > ________________________________________________________________________ ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________ ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________