-
Notifications
You must be signed in to change notification settings - Fork 221
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
Treat locales with variants case insensitively #195
Conversation
While I'm loathe to do anything that encourages people to send broken request headers (:scream_cat:), the RFCs say that locale specifiers are case-insensitive, so your change is a win for that reason. |
@mpalmer Thanks for the quick response on this. So quick that I wasn't able to verify that the unit test I added works 😮 My bad. I was having some trouble getting dependencies installed and happy on my machine. |
Yeah, if CI passes, it seems reasonable to assume it's working. What were the errors you were seeing locally? |
Following the instructions here, I was seeing this from a fresh clone of the repo:
If I add
I think that was around where I stopped, because I wasn't sure how many more dependencies I'd need to install. But, as one last hurrah, I tried a
|
Whoof, yeah, those instructions are waaaay out of date (as evidenced by the fact that it mentions Ruby 1.8...) I'll make an issue to get that sorted out, but in the meantime, CI says everything's good, and that's good enough for me. 🎉 |
This code base could do with a lot of TLC, feel free to take the lead on updating it if you have the time and energy to do so. |
Ok I will try to get the readme updated at least. Thanks for the assistance y'all 🙏 |
We've noticed a few clients sending along funny locales like
English
These result in the following error:
That's happening because the locale variant match is case insensitive:
https://github.com/rack/rack-contrib/blob/main/lib/rack/contrib/locale.rb#L91
But then the locale is extracted without a downcase.
I believe it should be safe to just downcase the locale from the client in these cases.