|
I edited the issue itself a bit, so that the issue itself makes immediately clear what the supposed problem would be, please check if I summarized and interpreted your problem correctly.
Here is some code notes: [configs/application.ini] [index/index.phtml] echo '<br>Language: ' . $locale->getLanguage(); [output with Zend version of Locale resource's getLocale()] (Notice that even though the preferred language in HTTP_ACCEPT_LANGUAGE is "de-DE", [output using getLocale() based on code in the above comment] (Notice that the Locale created by the modified Locale resource is correctly set Also, this problem exists in the current (1.9.4) release. Ignore the previous comment. It is a problem in the current release (1.9.6) I just checkout the SVN trunk code. The problem exists in trunk. Note: this is a problem with Zend_Application_Resource_Locale::getLocale(). Should be fixed now, thank you for reporting. If you still encounter this issue, please reopen it (and add a comment). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
When the application.ini file sets a default (fall-back) locale, Zend_Application_Resource_Locale incorrectly creates the locale object with it. This default should be set before creating the locale object and then create the object using automatic locale discovery.
For instance, the getLocale() function should be modified similar to this:
public function getLocale()
{
// Zend version incorrectly ignores HTTP_ACCEPT_LANGUAGE value when create locale object
if (null === $this->_locale) {
$options = $this->getOptions();
if (isset($options['default'])) { // Set the fall-back locale Zend_Locale::setDefault($options['default']); } else { // Should the web server's locale be set as a default when none provided? }
// Now create the locale with automatic locale discovery enabled (the default method)
$this->_locale = new Zend_Locale();
$key = (isset($options['registry_key']) && !is_numeric($options['registry_key']))
? $options['registry_key']
: self::DEFAULT_REGISTRY_KEY;
Zend_Registry::set($key, $this->_locale);
}
return $this->_locale;
}