centurion-project / Centurion

Centurion is an open-source CMS delivered as a flexible PHP5 Content Management Framework
http://www.centurion-project.org
197 stars 51 forks source link

Translatable linked datas displayed in wrong language #47

Open aurmil opened 12 years ago

aurmil commented 12 years ago

when displaying translatable datas in back office, browser language is used instead of back office language this is due to "new Zend_Locale()" instanciation in library/Centurion/Contrib/translation/controllers/helpers/ManageLanguageParam.php without nay param, it takes brower language language should be the one used in back office

possible fix:

$controller = $this->getActionController();
if (!($requestedLocale = $controller->getRequest()->getParam('language', false))) {
    $bootstrap = $controller->getInvokeArg('bootstrap');
    $options = $bootstrap->getOptions();
    $default = null;

    if (isset($options['resources']['locale']['force']) && (1 == $options['resources']['locale']['force']))
    {
        $default = $options['resources']['locale']['default'];
    }

    $local = new Zend_Locale($default);
    $requestedLocale = $local->getLanguage();
}