Closed stuartf closed 10 years ago
I wanted to make sure this doesn't break the quality ordering before merging, in node I can do:
var supported = new locale.Locales(["en-US", "en", "ja", "da-DK"]);
new locale.Locales("ja;q=.5, da").best(supported).toString();
and get da_DK
which is correct. But when I add a test that does the same thing:
(next) ->
http.get port: 8000, headers: "Accept-Language": "ja;q=.8, da", (res) ->
assert.equal(
res.headers["content-language"]
"da_DK"
"Countryless request falls back to countried language even when there's a lower quality exact ma tch"
)
do next
The test suite suddenly takes 3 minutes to run...
that's interesting, the test passes within the 2 second mocha timeout on travis, but on my local machine I had to push the timeout up until:
✓ should fallback to a country specific language even when there's a lower quality exact match (120029ms)
found it, have to explicitly close the connection
According to rfc 2616 section 14.4 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
Thus I would expect
To give me
es_ES
but it gives meen_US
because that'slocale.Locale.default