basz / SlmLocale

Auto detection of locale through different strategies for Zend Framework 2
Other
67 stars 34 forks source link

Problem in HttpAcceptLanguageStrategy #48

Closed 10257 closed 7 years ago

10257 commented 10 years ago

If you use the locale format from zend default install (ex: fr_FR, en_US,...), the HttpAcceptLanguage Strategy does not find the locale in the supported array.

With the following conf :

return array(
    'slm_locale' => array(
        'default' => 'es_ES',
        'supported' => array('es_ES', 'en_US'),
        'strategies' => array('acceptlanguage')
);

If the received Accept-Language header is for example :

"fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3"

the locale will be set to the default es_ES. I think it should be set to en_US.

moderndeveloperllc commented 10 years ago

:+1: This helps with the locale vs language tag issues that can creep up