resolve-accept-language
Advanced tools
Comparing version 1.1.52 to 1.1.53
{ | ||
"name": "resolve-accept-language", | ||
"version": "1.1.52", | ||
"version": "1.1.53", | ||
"description": "Resolve the preferred locale based on the value of an `Accept-Language` HTTP header.", | ||
@@ -42,4 +42,4 @@ "keywords": [ | ||
"@types/jest": "29.5.1", | ||
"@typescript-eslint/eslint-plugin": "5.59.0", | ||
"@typescript-eslint/parser": "5.59.0", | ||
"@typescript-eslint/eslint-plugin": "5.59.1", | ||
"@typescript-eslint/parser": "5.59.1", | ||
"dotenv-cli": "7.2.1", | ||
@@ -61,3 +61,3 @@ "eslint": "8.39.0", | ||
"prettier-plugin-sh": "0.12.8", | ||
"release-it": "15.10.1", | ||
"release-it": "15.10.2", | ||
"ts-jest": "29.1.0", | ||
@@ -64,0 +64,0 @@ "ts-node": "10.9.1", |
@@ -72,4 +72,3 @@ # resolve-accept-language | ||
As per RFC 4647, this package uses the "lookup" matching scheme. This means that it will always produce exactly one match for a | ||
given request. | ||
As per RFC 4647, this package uses the "lookup" matching scheme. This means that it will always produce exactly one match for a given request. | ||
@@ -81,10 +80,6 @@ The matching strategy will use the following logic: | ||
3. Three different matching patterns (based on the HTTP header's quality factor and order of the provided locales): | ||
1. If there were any matches, get the highest-ranked (quality factor) locale or language code: | ||
1. **Locale-based match**: Is the highest-ranked a locale? If yes, this is the best match. | ||
2. **Language-based match**: Otherwise, find the first locale that matches the highest-ranked language. | ||
2. **Related-locale-based match**: If there is no match, find the first locale with a language that matches the highest-ranked language of locales that were not in scope. This is a bit of a "fuzzy match", but the presumption is that it's better to show content in a language that can be understood even if the country is wrong. | ||
4. When using `resolveAcceptLanguage` return the default locale as a last resort option. | ||
@@ -91,0 +86,0 @@ |
35743
104