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

Language in Firefox #367

Closed
BNYBLN030 opened this issue Apr 3, 2020 · 3 comments
Closed

Language in Firefox #367

BNYBLN030 opened this issue Apr 3, 2020 · 3 comments

Comments

@BNYBLN030
Copy link

the Language for Firefox with de_DE.csv doesnt work! In IE it works automatically ...
should I change something in the config?

@eljeffeg
Copy link
Collaborator

eljeffeg commented Apr 3, 2020

So, this is a bug in Tornado itself. tornadoweb/tornado#1858
I'll write a work around since it was reported in 2016 and they haven't fixed it. Essentially the browser is returning de as an acceptable language and Tornado should choose the closest match, which is de_DE, but since it's not exact, it falls back to english. This is in contrast to what their documentation says it should do.

@eljeffeg
Copy link
Collaborator

eljeffeg commented Apr 3, 2020

I've submitted a pull request to Tornado with a fix. I'm not sure if I should create a work around in RootTheBox (easy to do) or mark this pending a Tornado update. @moloch-- thoughts?

I could add this code to BaseHandler in get_user_locale():

codes = self.request.headers.get("Accept-Language")
if codes:
    for code in codes.split(","):
        code = code.split(";")[0]
        for l in locale.get_supported_locales():
            if code.lower() == l.split("_")[0]:
                return locale.get(l)

eljeffeg added a commit that referenced this issue Apr 10, 2020
@eljeffeg
Copy link
Collaborator

Pushed up a temporary fix, since the Tornado folks have not commented on the issue or pull request.

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

2 participants