-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check_language function - language settings are ignored #28
Comments
Nice catch - you are right that the POST and COOKIE value should be honored even if HTTP_ACCEPT_LANGUAGE is not set. I tend to do a slightly different fix - instead of making the function even more confusing with array_merge(), it should handle POST and COOKIE first.
I gave this patch only minimal testing (which is also the reason why I didn't commit it yet), so feel free to test and report back ;-) |
In the meantime I have replaced the function with my own version, that respects HTTP_ACCEPT_LANGUAGE priorities as well. I have also made some basic cleanup like the order of tests etc. `
} |
If $_POST['lang'] or $_COOKIE['lang'] is set, this means the user selected a language manually in the dropdown now ($_POST) or some days ago ($_COOKIE). Therefore $_POST and $_COOKIE should always win - if they contain a valid language, there's no need to check HTTP_ACCEPT_LANGUAGE. Besides that - honoring the priorities is a nice addition, thanks! It's clearly worth the additional CPU cycles, but it reminds me to |
When the browser doesn't supply the HTTP_ACCEPT_LANGUAGE header, language setting are ignored and postfixadmin always defaults to the $CONF['default_language'] setting.
IMO the desired behavior should not be dependent on the presence of the HTTP_ACCEPT_LANGUAGE header. Eg:
`
function check_language ($use_post = 1) {
global $supported_languages; # from languages/languages.php
}
`
The text was updated successfully, but these errors were encountered: