i18next-http-middleware 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
7
+ var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab', '419'];
8
8
  var _default = exports.default = {
9
9
  name: 'header',
10
10
  lookup: function lookup(req, res, options) {
@@ -20,7 +20,7 @@ var _default = exports.default = {
20
20
  var foundSpecialCase = specialCases.find(function (s) {
21
21
  return acceptLanguage.toLowerCase().indexOf("-".concat(s)) > 0;
22
22
  });
23
- if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z]{4})?)\s*;?\s*(q=([0-9.]+))?/gi;
23
+ if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z0-9]{2,4})?)\s*;?\s*(q=([0-9.]+))?/gi;
24
24
  }
25
25
  var lngs = [];
26
26
  var i;
@@ -1,4 +1,4 @@
1
- var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
1
+ var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab', '419'];
2
2
  export default {
3
3
  name: 'header',
4
4
  lookup: function lookup(req, res, options) {
@@ -14,7 +14,7 @@ export default {
14
14
  var foundSpecialCase = specialCases.find(function (s) {
15
15
  return acceptLanguage.toLowerCase().indexOf("-".concat(s)) > 0;
16
16
  });
17
- if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z]{4})?)\s*;?\s*(q=([0-9.]+))?/gi;
17
+ if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z0-9]{2,4})?)\s*;?\s*(q=([0-9.]+))?/gi;
18
18
  }
19
19
  var lngs = [];
20
20
  var i;
@@ -1,4 +1,4 @@
1
- const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab']
1
+ const specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab', '419']
2
2
 
3
3
  export default {
4
4
  name: 'header',
@@ -17,7 +17,7 @@ export default {
17
17
  let lookupRegex = /(([a-z]{2,3})-?([A-Z]{2})?)\s*;?\s*(q=([0-9.]+))?/gi
18
18
  if (acceptLanguage.indexOf('-') > 0) {
19
19
  const foundSpecialCase = specialCases.find((s) => acceptLanguage.toLowerCase().indexOf(`-${s}`) > 0)
20
- if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z]{4})?)\s*;?\s*(q=([0-9.]+))?/gi
20
+ if (foundSpecialCase) lookupRegex = /(([a-z]{2,3})-?([A-Z0-9]{2,4})?)\s*;?\s*(q=([0-9.]+))?/gi
21
21
  }
22
22
  const lngs = []; let i; let m
23
23
  const rgx = options.lookupHeaderRegex || lookupRegex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-http-middleware",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./cjs/index.js",