update node modules

This commit is contained in:
s2
2020-07-20 16:20:39 +02:00
parent dcb748f037
commit f9fb05e4db
906 changed files with 124011 additions and 93468 deletions

View File

@@ -1,3 +1,11 @@
### 4.3.1
- typescript Updated typescript typings for DetectorOptions to align with current options [216](https://github.com/i18next/i18next-browser-languageDetector/pull/216)
### 4.3.0
- sessionStorage support [215](https://github.com/i18next/i18next-browser-languageDetector/pull/215)
### 4.2.0
- Add config option checkForSimilarInWhitelist [211](https://github.com/i18next/i18next-browser-languageDetector/pull/211)

View File

@@ -7,6 +7,7 @@
This is a i18next language detection plugin use to detect user language in the browser with support for:
- cookie (set cookie i18next=LANGUAGE)
- sessionStorage (set key i18nextLng=LANGUAGE)
- localStorage (set key i18nextLng=LANGUAGE)
- navigator (set browser language)
- querystring (append `?lng=LANGUAGE` to URL)
@@ -46,7 +47,7 @@ As with all modules you can either pass the constructor function (class) to the
```js
{
// order and from where user language should be detected
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag', 'path', 'subdomain'],
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag', 'path', 'subdomain'],
// keys or params to lookup language from
lookupQuerystring: 'lng',
@@ -108,7 +109,7 @@ via calling init:
```js
import LanguageDetector from 'i18next-browser-languagedetector';
const languageDetector = new LanguageDetector();
lngDetector.init(options);
languageDetector.init(options);
```
## Adding own detection functionality
@@ -159,3 +160,15 @@ Don't forget: You have to add the name of your detector (`myDetectorsName` in th
<img src="https://raw.githubusercontent.com/i18next/i18next/master/assets/locize_sponsor_240.gif" width="240px">
</a>
</p>
---
**localization as a service - locize.com**
Needing a translation management? Want to edit your translations with an InContext Editor? Use the orginal provided to you by the maintainers of i18next!
![locize](https://locize.com/img/ads/github_locize.png)
With using [locize](http://locize.com/?utm_source=react_i18next_readme&utm_medium=github) you directly support the future of i18next and react-i18next.
---

View File

@@ -135,6 +135,36 @@ var localStorage = {
}
};
var hasSessionStorageSupport;
try {
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
var testKey$1 = 'i18next.translate.boo';
window.sessionStorage.setItem(testKey$1, 'foo');
window.sessionStorage.removeItem(testKey$1);
} catch (e) {
hasSessionStorageSupport = false;
}
var sessionStorage = {
name: 'sessionStorage',
lookup: function lookup(options) {
var found;
if (options.lookupsessionStorage && hasSessionStorageSupport) {
var lng = window.sessionStorage.getItem(options.lookupsessionStorage);
if (lng) found = lng;
}
return found;
},
cacheUserLanguage: function cacheUserLanguage(lng, options) {
if (options.lookupsessionStorage && hasSessionStorageSupport) {
window.sessionStorage.setItem(options.lookupsessionStorage, lng);
}
}
};
var navigator$1 = {
name: 'navigator',
lookup: function lookup(options) {
@@ -223,7 +253,7 @@ var subdomain = {
function getDefaults() {
return {
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
@@ -265,6 +295,7 @@ function () {
this.addDetector(cookie$1);
this.addDetector(querystring);
this.addDetector(localStorage);
this.addDetector(sessionStorage);
this.addDetector(navigator$1);
this.addDetector(htmlTag);
this.addDetector(path);

View File

@@ -131,6 +131,36 @@ var localStorage = {
}
};
var hasSessionStorageSupport;
try {
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
var testKey$1 = 'i18next.translate.boo';
window.sessionStorage.setItem(testKey$1, 'foo');
window.sessionStorage.removeItem(testKey$1);
} catch (e) {
hasSessionStorageSupport = false;
}
var sessionStorage = {
name: 'sessionStorage',
lookup: function lookup(options) {
var found;
if (options.lookupsessionStorage && hasSessionStorageSupport) {
var lng = window.sessionStorage.getItem(options.lookupsessionStorage);
if (lng) found = lng;
}
return found;
},
cacheUserLanguage: function cacheUserLanguage(lng, options) {
if (options.lookupsessionStorage && hasSessionStorageSupport) {
window.sessionStorage.setItem(options.lookupsessionStorage, lng);
}
}
};
var navigator$1 = {
name: 'navigator',
lookup: function lookup(options) {
@@ -219,7 +249,7 @@ var subdomain = {
function getDefaults() {
return {
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
@@ -261,6 +291,7 @@ function () {
this.addDetector(cookie$1);
this.addDetector(querystring);
this.addDetector(localStorage);
this.addDetector(sessionStorage);
this.addDetector(navigator$1);
this.addDetector(htmlTag);
this.addDetector(path);

View File

@@ -156,6 +156,36 @@
}
};
var hasSessionStorageSupport;
try {
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
var testKey$1 = 'i18next.translate.boo';
window.sessionStorage.setItem(testKey$1, 'foo');
window.sessionStorage.removeItem(testKey$1);
} catch (e) {
hasSessionStorageSupport = false;
}
var sessionStorage = {
name: 'sessionStorage',
lookup: function lookup(options) {
var found;
if (options.lookupsessionStorage && hasSessionStorageSupport) {
var lng = window.sessionStorage.getItem(options.lookupsessionStorage);
if (lng) found = lng;
}
return found;
},
cacheUserLanguage: function cacheUserLanguage(lng, options) {
if (options.lookupsessionStorage && hasSessionStorageSupport) {
window.sessionStorage.setItem(options.lookupsessionStorage, lng);
}
}
};
var navigator$1 = {
name: 'navigator',
lookup: function lookup(options) {
@@ -244,7 +274,7 @@
function getDefaults() {
return {
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
@@ -286,6 +316,7 @@
this.addDetector(cookie$1);
this.addDetector(querystring);
this.addDetector(localStorage);
this.addDetector(sessionStorage);
this.addDetector(navigator$1);
this.addDetector(htmlTag);
this.addDetector(path);

File diff suppressed because one or more lines are too long

View File

@@ -156,6 +156,36 @@
}
};
var hasSessionStorageSupport;
try {
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
var testKey$1 = 'i18next.translate.boo';
window.sessionStorage.setItem(testKey$1, 'foo');
window.sessionStorage.removeItem(testKey$1);
} catch (e) {
hasSessionStorageSupport = false;
}
var sessionStorage = {
name: 'sessionStorage',
lookup: function lookup(options) {
var found;
if (options.lookupsessionStorage && hasSessionStorageSupport) {
var lng = window.sessionStorage.getItem(options.lookupsessionStorage);
if (lng) found = lng;
}
return found;
},
cacheUserLanguage: function cacheUserLanguage(lng, options) {
if (options.lookupsessionStorage && hasSessionStorageSupport) {
window.sessionStorage.setItem(options.lookupsessionStorage, lng);
}
}
};
var navigator$1 = {
name: 'navigator',
lookup: function lookup(options) {
@@ -244,7 +274,7 @@
function getDefaults() {
return {
order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag'],
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
lookupQuerystring: 'lng',
lookupCookie: 'i18next',
lookupLocalStorage: 'i18nextLng',
@@ -286,6 +316,7 @@
this.addDetector(cookie$1);
this.addDetector(querystring);
this.addDetector(localStorage);
this.addDetector(sessionStorage);
this.addDetector(navigator$1);
this.addDetector(htmlTag);
this.addDetector(path);

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +1,27 @@
import * as i18next from "i18next";
import * as i18next from 'i18next';
interface DetectorOptions {
/**
* only detect languages that are in the whitelist
* @default true
*/
checkWhitelist?: boolean;
/**
* fallback to a similar whitelist language
* Example 1: Browser language is 'es'
* if 'es' is not found in whitelist, first fallback to any whitelist language that starts with 'es-', then fallback to fallbackLng ('es' -> 'es-*' -> fallbackLng)
* Example 2: Browser language is 'es-MX'
* if 'es-MX' is not found in whitelist, first fallback to 'es', then fallback to 'es-*', then fallback to fallbackLng ('es-MX' -> 'es' -> 'es-*' -> fallbackLng)
* @default false
*/
checkForSimilarInWhitelist?: boolean;
/**
* order and from where user language should be detected
*/
order?: Array<
"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string
'querystring' | 'cookie' | 'sessionStorage' | 'localStorage' | 'navigator' | 'htmlTag' | string
>;
/**
@@ -14,6 +30,8 @@ interface DetectorOptions {
lookupQuerystring?: string;
lookupCookie?: string;
lookupLocalStorage?: string;
lookupFromPathIndex?: number;
lookupFromSubdomainIndex?: number;
/**
* cache user language on
@@ -45,8 +63,7 @@ interface CustomDetector {
lookup(options: DetectorOptions): string | undefined;
}
export default class I18nextBrowserLanguageDetector
implements i18next.LanguageDetectorModule {
export default class I18nextBrowserLanguageDetector implements i18next.LanguageDetectorModule {
constructor(services?: any, options?: DetectorOptions);
/**
* Adds detector.
@@ -58,11 +75,11 @@ export default class I18nextBrowserLanguageDetector
*/
init(services?: any, options?: DetectorOptions): void;
detect(detectionOrder?: DetectorOptions["order"]): string | undefined;
detect(detectionOrder?: DetectorOptions['order']): string | undefined;
cacheUserLanguage(lng: string, caches?: string[]): void;
type: "languageDetector";
type: 'languageDetector';
detectors: { [key: string]: any };
services: any;
i18nOptions: any;

View File

@@ -1,26 +1,27 @@
{
"_from": "i18next-browser-languagedetector@^4.2.0",
"_id": "i18next-browser-languagedetector@4.2.0",
"_from": "i18next-browser-languagedetector@4.3.1",
"_id": "i18next-browser-languagedetector@4.3.1",
"_inBundle": false,
"_integrity": "sha512-qRSCBWgDUSqVQb3sTxkDC+ImYLhF+wB387Y1RpOcJvyex+V3abi+W83n4Awy+dx719AOBbKTy97FjrUGrAhbyw==",
"_integrity": "sha512-KIToAzf8zwWvacgnRwJp63ase26o24AuNUlfNVJ5YZAFmdGhsJpmFClxXPuk9rv1FMI4lnc8zLSqgZPEZMrW4g==",
"_location": "/i18next-browser-languagedetector",
"_phantomChildren": {},
"_requested": {
"type": "range",
"type": "version",
"registry": true,
"raw": "i18next-browser-languagedetector@^4.2.0",
"raw": "i18next-browser-languagedetector@4.3.1",
"name": "i18next-browser-languagedetector",
"escapedName": "i18next-browser-languagedetector",
"rawSpec": "^4.2.0",
"rawSpec": "4.3.1",
"saveSpec": null,
"fetchSpec": "^4.2.0"
"fetchSpec": "4.3.1"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.2.0.tgz",
"_shasum": "82e35d31f88a1d7c2b6d5913bf8c8481cd40aafb",
"_spec": "i18next-browser-languagedetector@^4.2.0",
"_resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.3.1.tgz",
"_shasum": "005d2db6204b0a4af5f01c7987f5ccaf4ef97da5",
"_spec": "i18next-browser-languagedetector@4.3.1",
"_where": "D:\\Projects\\vanillajs-seed",
"author": {
"name": "Jan Mühlemann",
@@ -87,5 +88,5 @@
"test:typescript:noninterop": "tslint --project tsconfig.nonEsModuleInterop.json"
},
"types": "./index.d.ts",
"version": "4.2.0"
"version": "4.3.1"
}