Closed mttkay closed 11 years ago
The problem is in your example. The RFC for language tags specifies that locales should be separated from languages by a hyphen, not an underscore. If you change your example you'll get the proper result.
req.best_language(%w(fr-fr en-gb))
=> "en-gb"
Oh dear, thanks! You're right of course. Fixed this in our backend. Sorry for the noise.
No problem. Thank you for reporting what you thought was an issue. More eyes makes for better code!
Not sure if this behavior is defined in the RFC, but the current implementation of language matching seems broken to me:
why does
en_GB
not matchen
? A client requesting just a language code, not a specific locale, is obviously only interested in the language part, not the country, so this should match all locale codes starting withen_*
?