Skip to content
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

Accepted browser language cannot be correctly detected #5301

Closed
arnisjuraga opened this issue Mar 23, 2017 · 6 comments
Closed

Accepted browser language cannot be correctly detected #5301

arnisjuraga opened this issue Mar 23, 2017 · 6 comments

Comments

@arnisjuraga
Copy link
Contributor

Modern browsers uses additional priority weight value in a header.
In a result, startup.php will not detect browser language correctly:

e.g.
https://github.com/opencart/opencart/blob/master/upload/catalog/controller/startup/startup.php#L57

will return:

array(4) { 
    [0]=> string(5) "en-US" 
    [1]=> string(8) "en;q=0.8" 
    [2]=> string(8) "lv;q=0.6" 
    [3]=> string(8) "lt;q=0.4"
}

in a result, in_array will not return true for any strings with q parameter.

http://stackoverflow.com/questions/6157485/content-language-and-accept-language
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4

@danielkerr
Copy link
Member

danielkerr commented Mar 24, 2017

look m* u might think you know everything but when it comes to open source and having the language system working on as many system as possible it does not work so well!

the current system is fine and has been working fine for many years!

now stop trying to post changes that will cause issues for many users!

when u post these suggestion you have done zero testing! and expect me just to implement it!~

u make a suggestion i want to see tests and videos of it working across multiple browsers!

@danielkerr
Copy link
Member

danielkerr commented Mar 24, 2017

i dont why u even posted this crap as an issue! wasting my time

@arnisjuraga
Copy link
Contributor Author

I have done tests, the I have already posted. Just check out these:

https://forum.opencart.com/viewtopic.php?f=161&t=113954
https://forum.opencart.com/viewtopic.php?f=191&t=143372
https://forum.opencart.com/viewtopic.php?f=20&t=52319

@arnisjuraga
Copy link
Contributor Author

arnisjuraga commented Mar 24, 2017

it IS and WILL work only for the first language in $browser_languages array because it does not have quality score added. You can't match en-US with en-us;q=0.5, right?

if you want to serve and use one and the only language for the site, or use as the only "primary" language, as most of the Opencart users - then it's not a problem and the site will work well. Just read my code, read the forum, and read the wiki.

As I told - you will not have problems, if your site "default" language is set to en, because most of the users have English as a primary acceptable browser language.

@iplocker
Copy link

iplocker commented Aug 1, 2017

Hello.
I have the issue as well , try a default 2.3.0.2 installation and install Greeks, always when I visit the site at front I am taking English language even if I have Greeks as default language .
Thanks arnisjuraga your fix with the startup.php it works.
Thanks

@zemguru
Copy link

zemguru commented Aug 6, 2017

#5301 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants