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

Localisation error: when Accept-Language header is Swedish (sv-SE), Chinese is shown #69

Open
aral opened this issue Mar 31, 2016 · 2 comments

Comments

@aral
Copy link
Contributor

aral commented Mar 31, 2016

When Accept-Language: sv-SE header is set, the localisation appears in Chinese:

Check if this is a greater issue with RoR AutoLocale implementation and fix at the right place.

napkin 3 31-03-16 9 40 24 am

Possible culprit:

In application_controller.rb:

class ApplicationController < ActionController::Base
  include HttpAcceptLanguage::AutoLocale
@aral
Copy link
Contributor Author

aral commented Mar 31, 2016

So here’s what I’ve found:

  1. Tried to reproduce locally on OS-X running Ruby 2.2.3, Rails 4.2.1, i18n 0.7.0, http_accept_language 2.0.5 and couldn’t
  2. On my OpenStack-based deployment environment where Boarding is running under Dokku, I can reproduce it everytime.

Tried:

1. To set default locale explicitly in config/application.rb:

config.i18n.default_locale = :en 

This seemed to help but I was randomly still getting other localisations (oddly, it seemed like I was getting some of the ones I’d explicitly visited earlier but with no discernible pattern between requests)

2. As a workaround, to disable localisation:

This isn’t an issue for us at the moment as the app is initially only available in English.

In /controllers/application_controller.rb:

class ApplicationController < ActionController::Base
  # include HttpAcceptLanguage::AutoLocale

I wonder if this is related to: iain/http_accept_language#50

(And, specifically, iain/http_accept_language@7319215)

Will review again once we have localised versions of the app itself.

@KrauseFx
Copy link
Member

KrauseFx commented Apr 2, 2016

Thanks for investigating this, keep me up to date on this 👍

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