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

Does not work with traditonal vs simplified Chinese #55

Open
ragesoss opened this issue Jun 26, 2016 · 5 comments
Open

Does not work with traditonal vs simplified Chinese #55

ragesoss opened this issue Jun 26, 2016 · 5 comments

Comments

@ragesoss
Copy link

The way that this gem throws out everything after a dash means that it is broken for Chinese locales. Typically, the languages codes are zh-hant, zh-hans, zh-CN, zh-TW, etc.

With the default methods, this gem always serves the first zh available zh variant. But almost any internationalized site that supports Chinese will have two or more variants, and getting simplified Chinese when you read traditional Chinese is not a usable situation.

Here's how I worked around it in my app: WikiEducationFoundation/WikiEduDashboard@cea14bc

I suggest that this gem would be a much more robust solution if it followed the RFC spec, rather than the current behavior described in the readme.

@bsiegel
Copy link

bsiegel commented Jul 22, 2016

I have a fork here that has implemented fallback for Chinese languages: https://github.com/mobiledefense/http_accept_language

Information about the algorithm used to select the appropriate locale is in the README.md

@recipedude
Copy link

This is also an issue with English.

config.i18n.available_locales = %w(en en-CA en-AU en-GB zh-CN fr es)

The gem seems to return en no matter what variety of English the end-user browser is requesting (in this case US English) for Canadians, Aussies, Brits as well.

@gommo
Copy link

gommo commented Jul 29, 2017

Yeah pretty weird that it was implemented the way it is

@KelseyDH
Copy link

KelseyDH commented Aug 17, 2021

I can no longer recommend this gem for any project unless this behaviour gets fixed. Either with a new method that preserves regional variance or by updating the existing method to return the correct region. To not break current (buggy) behaviour, I suspect adding a new method that preserves regional variance might be better, given it could cause problems if the currently buggy behaviour of apps receiving browser headers asking for en-gb being pointed to en... suddenly starting having those locales pointed to missing or incomplete en-gb files.

@arianf
Copy link

arianf commented Feb 26, 2024

What gem is everyone else using if not this one?

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

6 participants