Comparing version 1.4.0 to 1.5.0
@@ -400,4 +400,4 @@ /** | ||
/** | ||
* Gets the appropriate locale for a request, based on the X-App-Locale header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Locale as a first choice, for forcing the locale on a browser. | ||
* Gets the appropriate locale for a request, based on the X-App-Language header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Language as a first choice for forcing the locale on a browser. | ||
* | ||
@@ -409,3 +409,5 @@ * @param registry The locales registry to get registered locales from. | ||
function getSupportedLocaleFromRequest(registry, req) { | ||
const wanted = req.headers['x-app-locale']; | ||
var _a; | ||
const wanted = (_a = req.headers['x-app-language']) !== null && _a !== void 0 ? _a : req.headers['x-app-locale']; | ||
return typeof wanted == 'string' ? registry.getSupportedLocale(wanted) : registry.defaultLocale; | ||
@@ -412,0 +414,0 @@ } |
@@ -578,4 +578,4 @@ (function (global, factory) { | ||
/** | ||
* Gets the appropriate locale for a request, based on the X-App-Locale header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Locale as a first choice, for forcing the locale on a browser. | ||
* Gets the appropriate locale for a request, based on the X-App-Language header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Language as a first choice for forcing the locale on a browser. | ||
* | ||
@@ -587,3 +587,5 @@ * @param registry The locales registry to get registered locales from. | ||
function getSupportedLocaleFromRequest(registry, req) { | ||
var wanted = req.headers['x-app-locale']; | ||
var _a; | ||
var wanted = (_a = req.headers['x-app-language']) !== null && _a !== void 0 ? _a : req.headers['x-app-locale']; | ||
return typeof wanted == 'string' ? registry.getSupportedLocale(wanted) : registry.defaultLocale; | ||
@@ -590,0 +592,0 @@ } |
{ | ||
"name": "@mitm/intl", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@types/express": "*" |
@@ -67,4 +67,4 @@ import type { Request } from 'express'; | ||
/** | ||
* Gets the appropriate locale for a request, based on the X-App-Locale header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Locale as a first choice, for forcing the locale on a browser. | ||
* Gets the appropriate locale for a request, based on the X-App-Language header. | ||
* @todo Support HTTP Accept-Language, but keeping X-App-Language as a first choice for forcing the locale on a browser. | ||
* | ||
@@ -71,0 +71,0 @@ * @param registry The locales registry to get registered locales from. |
51730
1126