@operato/i18n 1.0.0-alpha.2 → 1.0.0-alpha.20
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.
- package/CHANGELOG.md +145 -0
- package/demo/index.html +13 -6
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.js +6 -5
- package/dist/src/config.js.map +1 -1
- package/dist/src/http-backend/index.d.ts +16 -0
- package/dist/src/http-backend/index.js +154 -0
- package/dist/src/http-backend/index.js.map +1 -0
- package/dist/src/http-backend/request.d.ts +3 -0
- package/dist/src/http-backend/request.js +47 -0
- package/dist/src/http-backend/request.js.map +1 -0
- package/dist/src/http-backend/utils.d.ts +8 -0
- package/dist/src/http-backend/utils.js +24 -0
- package/dist/src/http-backend/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/src/config.ts +6 -5
- package/src/http-backend/index.ts +167 -0
- package/src/http-backend/request.ts +53 -0
- package/src/http-backend/utils.ts +25 -0
- package/translations/en.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
- package/demo/translations/en.json +0 -3
- package/demo/translations/ko.json +0 -3
- package/demo/translations/ms.json +0 -3
- package/demo/translations/zh.json +0 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,151 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.0.0-alpha.20](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.19...v1.0.0-alpha.20) (2022-03-15)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @operato/i18n
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.0.0-alpha.19](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.18...v1.0.0-alpha.19) (2022-03-14)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @operato/i18n
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
## [1.0.0-alpha.18](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2022-03-14)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package @operato/i18n
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
## [1.0.0-alpha.17](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2022-03-13)
|
31
|
+
|
32
|
+
**Note:** Version bump only for package @operato/i18n
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
## [1.0.0-alpha.16](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.15...v1.0.0-alpha.16) (2022-03-13)
|
39
|
+
|
40
|
+
**Note:** Version bump only for package @operato/i18n
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
## [1.0.0-alpha.15](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-13)
|
47
|
+
|
48
|
+
**Note:** Version bump only for package @operato/i18n
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
## [1.0.0-alpha.14](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-13)
|
55
|
+
|
56
|
+
**Note:** Version bump only for package @operato/i18n
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
## [1.0.0-alpha.13](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-13)
|
63
|
+
|
64
|
+
**Note:** Version bump only for package @operato/i18n
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
## [1.0.0-alpha.12](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2022-03-13)
|
71
|
+
|
72
|
+
**Note:** Version bump only for package @operato/i18n
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
## [1.0.0-alpha.11](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2022-03-12)
|
79
|
+
|
80
|
+
**Note:** Version bump only for package @operato/i18n
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
## [1.0.0-alpha.10](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-03-12)
|
87
|
+
|
88
|
+
**Note:** Version bump only for package @operato/i18n
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
## [1.0.0-alpha.9](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-03-12)
|
95
|
+
|
96
|
+
**Note:** Version bump only for package @operato/i18n
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
## [1.0.0-alpha.8](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-03-11)
|
103
|
+
|
104
|
+
**Note:** Version bump only for package @operato/i18n
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
## [1.0.0-alpha.7](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2022-03-11)
|
111
|
+
|
112
|
+
**Note:** Version bump only for package @operato/i18n
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
## [1.0.0-alpha.6](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2022-03-11)
|
119
|
+
|
120
|
+
**Note:** Version bump only for package @operato/i18n
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
## [1.0.0-alpha.5](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2022-03-11)
|
127
|
+
|
128
|
+
|
129
|
+
### :rocket: New Features
|
130
|
+
|
131
|
+
* migrate property-editor from things-factory ([272cdaa](https://github.com/hatiolab/operato/commit/272cdaafd74f3c3c597403f88655cb5cf4a81313))
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
## [1.0.0-alpha.4](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2022-03-11)
|
136
|
+
|
137
|
+
**Note:** Version bump only for package @operato/i18n
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
## [1.0.0-alpha.3](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2022-03-10)
|
144
|
+
|
145
|
+
**Note:** Version bump only for package @operato/i18n
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
6
151
|
## [1.0.0-alpha.2](https://github.com/hatiolab/operato/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2022-03-10)
|
7
152
|
|
8
153
|
**Note:** Version bump only for package @operato/i18n
|
package/demo/index.html
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
<html lang="en-GB">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8" />
|
5
|
+
<base href="/demo/" />
|
6
|
+
|
5
7
|
<style>
|
6
8
|
body {
|
7
9
|
background: #fafafa;
|
@@ -29,12 +31,17 @@
|
|
29
31
|
|
30
32
|
render(
|
31
33
|
html`
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
Translated :
|
35
|
+
<ox-i18n msgid="text.operato"></ox-i18n>
|
36
|
+
<ox-i18n-selector
|
37
|
+
.value=${i18next.language || 'en-US'}
|
38
|
+
@change=${e => {
|
39
|
+
var locale = e.detail
|
40
|
+
locale && i18next.changeLanguage(locale)
|
41
|
+
}}
|
42
|
+
>
|
43
|
+
</ox-i18n-selector>
|
44
|
+
`,
|
38
45
|
parent
|
39
46
|
)
|
40
47
|
</script>
|
package/dist/src/config.d.ts
CHANGED
package/dist/src/config.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
/**
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
|
-
import
|
4
|
+
// import Backend from 'i18next-http-backend'
|
5
|
+
import { Backend } from './http-backend';
|
5
6
|
import LngDetector from 'i18next-browser-languagedetector';
|
6
|
-
import
|
7
|
-
|
7
|
+
import _i18next from 'i18next';
|
8
|
+
_i18next
|
8
9
|
.use(LngDetector)
|
9
|
-
.use(
|
10
|
+
.use(Backend)
|
10
11
|
.init({
|
11
12
|
fallbackLng: 'en',
|
12
13
|
debug: true,
|
@@ -33,5 +34,5 @@ i18next
|
|
33
34
|
cookieOptions: { path: '/', sameSite: 'strict' }
|
34
35
|
}
|
35
36
|
});
|
36
|
-
export
|
37
|
+
export const i18next = _i18next;
|
37
38
|
//# sourceMappingURL=config.js.map
|
package/dist/src/config.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,OAAO,MAAM,
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,WAAW,MAAM,kCAAkC,CAAA;AAC1D,OAAO,QAAQ,MAAM,SAAS,CAAA;AAE9B,QAAQ;KACL,GAAG,CAAC,WAAW,CAAC;KAChB,GAAG,CAAC,OAAO,CAAC;KACZ,IAAI,CAAC;IACJ,WAAW,EAAE,IAAI;IACjB,KAAK,EAAE,IAAI;IACX,EAAE,EAAE,CAAC,cAAc,CAAC;IACpB,SAAS,EAAE,cAAc;IACzB,YAAY,EAAE,KAAK;IACnB,aAAa,EAAE;QACb,MAAM,EAAE,GAAG;QACX,MAAM,EAAE,GAAG;KACZ;IACD,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE;QACP,QAAQ,EAAE,kBAAkB;KAC7B;IACD,SAAS,EAAE;QACT,wDAAwD;QACxD,KAAK,EAAE,CAAC,QAAQ,CAAC;QAEjB,yCAAyC;QACzC,YAAY,EAAE,SAAS;QAEvB,yBAAyB;QACzB,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,eAAe,EAAE,CAAC,QAAQ,CAAC;QAE3B,qIAAqI;QACrI,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE;KACjD;CACF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\n// import Backend from 'i18next-http-backend'\nimport { Backend } from './http-backend'\nimport LngDetector from 'i18next-browser-languagedetector'\nimport _i18next from 'i18next'\n\n_i18next\n .use(LngDetector)\n .use(Backend)\n .init({\n fallbackLng: 'en',\n debug: true,\n ns: ['translations'],\n defaultNS: 'translations',\n keySeparator: false,\n interpolation: {\n prefix: '{',\n suffix: '}'\n },\n load: 'languageOnly',\n backend: {\n loadPath: '/{ns}/{lng}.json'\n },\n detection: {\n // order and from where user language should be detected\n order: ['cookie'],\n\n // keys or params to lookup language from\n lookupCookie: 'i18next',\n\n // cache user language on\n caches: ['cookie'],\n excludeCacheFor: ['cimode'], // languages to not persist (cookie, localStorage)\n\n // optional set cookie options, reference:[MDN Set-Cookie docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n cookieOptions: { path: '/', sameSite: 'strict' }\n }\n })\n\nexport const i18next = _i18next\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ModuleType } from 'i18next';
|
2
|
+
export declare class Backend {
|
3
|
+
static type: ModuleType;
|
4
|
+
services: any;
|
5
|
+
options: any;
|
6
|
+
allOptions: any;
|
7
|
+
type: string;
|
8
|
+
constructor(services: any, options?: any, allOptions?: any);
|
9
|
+
init(services: any, options?: any, allOptions?: any): void;
|
10
|
+
readMulti(languages: any, namespaces: any, callback: any): void;
|
11
|
+
read(language: any, namespace: any, callback: any): void;
|
12
|
+
_readAny(languages: any, loadUrlLanguages: any, namespaces: any, loadUrlNamespaces: any, callback: any): void;
|
13
|
+
loadUrl(url: string, callback: any, languages: any, namespaces: any): void;
|
14
|
+
create(languages: any, namespace: any, key: any, fallbackValue: any, callback: any): void;
|
15
|
+
reload(): void;
|
16
|
+
}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
// migrated from https://github.com/i18next/i18next-http-backend
|
2
|
+
// due to import module problem
|
3
|
+
import { makePromise } from './utils.js';
|
4
|
+
import { request } from './request.js';
|
5
|
+
const getDefaults = () => {
|
6
|
+
return {
|
7
|
+
loadPath: '/locales/{{lng}}/{{ns}}.json',
|
8
|
+
addPath: '/locales/add/{{lng}}/{{ns}}',
|
9
|
+
allowMultiLoading: false,
|
10
|
+
parse: (data) => JSON.parse(data),
|
11
|
+
stringify: JSON.stringify,
|
12
|
+
parsePayload: (namespace, key, fallbackValue) => ({ [key]: fallbackValue || '' }),
|
13
|
+
request,
|
14
|
+
reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,
|
15
|
+
customHeaders: {},
|
16
|
+
queryStringParams: {},
|
17
|
+
crossDomain: false,
|
18
|
+
withCredentials: false,
|
19
|
+
overrideMimeType: false,
|
20
|
+
requestOptions: {
|
21
|
+
// used for fetch
|
22
|
+
mode: 'cors',
|
23
|
+
credentials: 'same-origin',
|
24
|
+
cache: 'default'
|
25
|
+
}
|
26
|
+
};
|
27
|
+
};
|
28
|
+
export class Backend {
|
29
|
+
constructor(services, options = {}, allOptions = {}) {
|
30
|
+
this.services = services;
|
31
|
+
this.options = options;
|
32
|
+
this.allOptions = allOptions;
|
33
|
+
this.type = 'backend';
|
34
|
+
this.init(services, options, allOptions);
|
35
|
+
}
|
36
|
+
init(services, options = {}, allOptions = {}) {
|
37
|
+
this.services = services;
|
38
|
+
this.options = {
|
39
|
+
...getDefaults(),
|
40
|
+
...this.options,
|
41
|
+
...options
|
42
|
+
};
|
43
|
+
this.allOptions = allOptions;
|
44
|
+
if (this.services && this.options.reloadInterval) {
|
45
|
+
setInterval(() => this.reload(), this.options.reloadInterval);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
readMulti(languages, namespaces, callback) {
|
49
|
+
this._readAny(languages, languages, namespaces, namespaces, callback);
|
50
|
+
}
|
51
|
+
read(language, namespace, callback) {
|
52
|
+
this._readAny([language], language, [namespace], namespace, callback);
|
53
|
+
}
|
54
|
+
_readAny(languages, loadUrlLanguages, namespaces, loadUrlNamespaces, callback) {
|
55
|
+
let loadPath = this.options.loadPath;
|
56
|
+
if (typeof this.options.loadPath === 'function') {
|
57
|
+
loadPath = this.options.loadPath(languages, namespaces);
|
58
|
+
}
|
59
|
+
loadPath = makePromise(loadPath);
|
60
|
+
loadPath.then((resolvedLoadPath) => {
|
61
|
+
const url = this.services.interpolator.interpolate(resolvedLoadPath, {
|
62
|
+
lng: languages.join('+'),
|
63
|
+
ns: namespaces.join('+')
|
64
|
+
});
|
65
|
+
this.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces);
|
66
|
+
});
|
67
|
+
}
|
68
|
+
loadUrl(url, callback, languages, namespaces) {
|
69
|
+
this.options.request(this.options, url, undefined, (err, res) => {
|
70
|
+
if (res && ((res.status >= 500 && res.status < 600) || !res.status))
|
71
|
+
return callback('failed loading ' + url + '; status code: ' + res.status, true /* retry */);
|
72
|
+
if (res && res.status >= 400 && res.status < 500)
|
73
|
+
return callback('failed loading ' + url + '; status code: ' + res.status, false /* no retry */);
|
74
|
+
if (!res && err && err.message && err.message.indexOf('Failed to fetch') > -1)
|
75
|
+
return callback('failed loading ' + url + ': ' + err.message, true /* retry */);
|
76
|
+
if (err)
|
77
|
+
return callback(err, false);
|
78
|
+
let ret, parseErr;
|
79
|
+
try {
|
80
|
+
if (typeof res.data === 'string') {
|
81
|
+
ret = this.options.parse(res.data, languages, namespaces);
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
// fallback, which omits calling the parse function
|
85
|
+
ret = res.data;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
catch (e) {
|
89
|
+
parseErr = 'failed parsing ' + url + ' to json';
|
90
|
+
}
|
91
|
+
if (parseErr)
|
92
|
+
return callback(parseErr, false);
|
93
|
+
callback(null, ret);
|
94
|
+
});
|
95
|
+
}
|
96
|
+
create(languages, namespace, key, fallbackValue, callback) {
|
97
|
+
// If there is a falsey addPath, then abort -- this has been disabled.
|
98
|
+
if (!this.options.addPath)
|
99
|
+
return;
|
100
|
+
if (typeof languages === 'string')
|
101
|
+
languages = [languages];
|
102
|
+
const payload = this.options.parsePayload(namespace, key, fallbackValue);
|
103
|
+
let finished = 0;
|
104
|
+
const dataArray = [];
|
105
|
+
const resArray = [];
|
106
|
+
languages.forEach((lng) => {
|
107
|
+
let addPath = this.options.addPath;
|
108
|
+
if (typeof this.options.addPath === 'function') {
|
109
|
+
addPath = this.options.addPath(lng, namespace);
|
110
|
+
}
|
111
|
+
const url = this.services.interpolator.interpolate(addPath, { lng: lng, ns: namespace });
|
112
|
+
this.options.request(this.options, url, payload, (data, res) => {
|
113
|
+
// TODO: if res.status === 4xx do log
|
114
|
+
finished += 1;
|
115
|
+
dataArray.push(data);
|
116
|
+
resArray.push(res);
|
117
|
+
if (finished === languages.length) {
|
118
|
+
if (callback)
|
119
|
+
callback(dataArray, resArray);
|
120
|
+
}
|
121
|
+
});
|
122
|
+
});
|
123
|
+
}
|
124
|
+
reload() {
|
125
|
+
const { backendConnector, languageUtils, logger } = this.services;
|
126
|
+
const currentLanguage = backendConnector.language;
|
127
|
+
if (currentLanguage && currentLanguage.toLowerCase() === 'cimode')
|
128
|
+
return; // avoid loading resources for cimode
|
129
|
+
const toLoad = [];
|
130
|
+
const append = (lng) => {
|
131
|
+
const lngs = languageUtils.toResolveHierarchy(lng);
|
132
|
+
lngs.forEach((l) => {
|
133
|
+
if (toLoad.indexOf(l) < 0)
|
134
|
+
toLoad.push(l);
|
135
|
+
});
|
136
|
+
};
|
137
|
+
append(currentLanguage);
|
138
|
+
if (this.allOptions.preload)
|
139
|
+
this.allOptions.preload.forEach((l) => append(l));
|
140
|
+
toLoad.forEach((lng) => {
|
141
|
+
this.allOptions.ns.forEach((ns) => {
|
142
|
+
backendConnector.read(lng, ns, 'read', null, null, (err, data) => {
|
143
|
+
if (err)
|
144
|
+
logger.warn(`loading namespace ${ns} for language ${lng} failed`, err);
|
145
|
+
if (!err && data)
|
146
|
+
logger.log(`loaded namespace ${ns} for language ${lng}`, data);
|
147
|
+
backendConnector.loaded(`${lng}|${ns}`, err, data);
|
148
|
+
});
|
149
|
+
});
|
150
|
+
});
|
151
|
+
}
|
152
|
+
}
|
153
|
+
Backend.type = 'backend';
|
154
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http-backend/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,+BAA+B;AAG/B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,OAAO;QACL,QAAQ,EAAE,8BAA8B;QACxC,OAAO,EAAE,6BAA6B;QACtC,iBAAiB,EAAE,KAAK;QACxB,KAAK,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QACtC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,YAAY,EAAE,CAAC,SAAc,EAAE,GAAW,EAAE,aAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,aAAa,IAAI,EAAE,EAA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AAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAQ,EAAE,IAAS,EAAE,EAAE;oBACzE,IAAI,GAAG;wBAAE,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,SAAS,EAAE,GAAG,CAAC,CAAA;oBAC/E,IAAI,CAAC,GAAG,IAAI,IAAI;wBAAE,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;oBAEhF,gBAAgB,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;gBACpD,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;;AArIM,YAAI,GAAe,SAAS,CAAA","sourcesContent":["// migrated from https://github.com/i18next/i18next-http-backend\n// due to import module problem\n\nimport { ModuleType } from 'i18next'\nimport { makePromise } from './utils.js'\nimport { request } from './request.js'\n\nconst getDefaults = () => {\n return {\n loadPath: '/locales/{{lng}}/{{ns}}.json',\n addPath: '/locales/add/{{lng}}/{{ns}}',\n allowMultiLoading: false,\n parse: (data: any) => JSON.parse(data),\n stringify: JSON.stringify,\n parsePayload: (namespace: any, key: string, fallbackValue: any) => ({ [key]: fallbackValue || '' }),\n request,\n reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,\n customHeaders: {},\n queryStringParams: {},\n crossDomain: false, // used for XmlHttpRequest\n withCredentials: false, // used for XmlHttpRequest\n overrideMimeType: false, // used for XmlHttpRequest\n requestOptions: {\n // used for fetch\n mode: 'cors',\n credentials: 'same-origin',\n cache: 'default'\n }\n }\n}\n\nexport class Backend {\n static type: ModuleType = 'backend'\n\n services: any\n options: any\n allOptions: any\n type: string\n\n constructor(services: any, options: any = {}, allOptions: any = {}) {\n this.services = services\n this.options = options\n this.allOptions = allOptions\n this.type = 'backend'\n this.init(services, options, allOptions)\n }\n\n init(services: any, options: any = {}, allOptions: any = {}) {\n this.services = services\n this.options = {\n ...getDefaults(),\n ...this.options,\n ...options\n }\n this.allOptions = allOptions\n if (this.services && this.options.reloadInterval) {\n setInterval(() => this.reload(), this.options.reloadInterval)\n }\n }\n\n readMulti(languages: any, namespaces: any, callback: any) {\n this._readAny(languages, languages, namespaces, namespaces, callback)\n }\n\n read(language: any, namespace: any, callback: any) {\n this._readAny([language], language, [namespace], namespace, callback)\n }\n\n _readAny(languages: any, loadUrlLanguages: any, namespaces: any, loadUrlNamespaces: any, callback: any) {\n let loadPath = this.options.loadPath\n if (typeof this.options.loadPath === 'function') {\n loadPath = this.options.loadPath(languages, namespaces)\n }\n\n loadPath = makePromise(loadPath)\n\n loadPath.then((resolvedLoadPath: any) => {\n const url = this.services.interpolator.interpolate(resolvedLoadPath, {\n lng: languages.join('+'),\n ns: namespaces.join('+')\n })\n this.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces)\n })\n }\n\n loadUrl(url: string, callback: any, languages: any, namespaces: any) {\n this.options.request(this.options, url, undefined, (err: any, res: any) => {\n if (res && ((res.status >= 500 && res.status < 600) || !res.status))\n return callback('failed loading ' + url + '; status code: ' + res.status, true /* retry */)\n if (res && res.status >= 400 && res.status < 500)\n return callback('failed loading ' + url + '; status code: ' + res.status, false /* no retry */)\n if (!res && err && err.message && err.message.indexOf('Failed to fetch') > -1)\n return callback('failed loading ' + url + ': ' + err.message, true /* retry */)\n if (err) return callback(err, false)\n\n let ret, parseErr\n try {\n if (typeof res.data === 'string') {\n ret = this.options.parse(res.data, languages, namespaces)\n } else {\n // fallback, which omits calling the parse function\n ret = res.data\n }\n } catch (e) {\n parseErr = 'failed parsing ' + url + ' to json'\n }\n if (parseErr) return callback(parseErr, false)\n callback(null, ret)\n })\n }\n\n create(languages: any, namespace: any, key: any, fallbackValue: any, callback: any) {\n // If there is a falsey addPath, then abort -- this has been disabled.\n if (!this.options.addPath) return\n if (typeof languages === 'string') languages = [languages]\n const payload = this.options.parsePayload(namespace, key, fallbackValue)\n let finished = 0\n const dataArray: any = []\n const resArray: any = []\n languages.forEach((lng: any) => {\n let addPath = this.options.addPath\n if (typeof this.options.addPath === 'function') {\n addPath = this.options.addPath(lng, namespace)\n }\n const url = this.services.interpolator.interpolate(addPath, { lng: lng, ns: namespace })\n\n this.options.request(this.options, url, payload, (data: any, res: any) => {\n // TODO: if res.status === 4xx do log\n finished += 1\n dataArray.push(data)\n resArray.push(res)\n if (finished === languages.length) {\n if (callback) callback(dataArray, resArray)\n }\n })\n })\n }\n\n reload() {\n const { backendConnector, languageUtils, logger } = this.services\n const currentLanguage = backendConnector.language\n if (currentLanguage && currentLanguage.toLowerCase() === 'cimode') return // avoid loading resources for cimode\n\n const toLoad: any = []\n const append = (lng: any) => {\n const lngs = languageUtils.toResolveHierarchy(lng)\n lngs.forEach((l: any) => {\n if (toLoad.indexOf(l) < 0) toLoad.push(l)\n })\n }\n\n append(currentLanguage)\n\n if (this.allOptions.preload) this.allOptions.preload.forEach((l: any) => append(l))\n\n toLoad.forEach((lng: any) => {\n this.allOptions.ns.forEach((ns: any) => {\n backendConnector.read(lng, ns, 'read', null, null, (err: any, data: any) => {\n if (err) logger.warn(`loading namespace ${ns} for language ${lng} failed`, err)\n if (!err && data) logger.log(`loaded namespace ${ns} for language ${lng}`, data)\n\n backendConnector.loaded(`${lng}|${ns}`, err, data)\n })\n })\n })\n }\n}\n"]}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
const addQueryString = (url, params) => {
|
2
|
+
if (params && typeof params === 'object') {
|
3
|
+
let queryString = '';
|
4
|
+
// Must encode data
|
5
|
+
for (const paramName in params) {
|
6
|
+
queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName]);
|
7
|
+
}
|
8
|
+
if (!queryString)
|
9
|
+
return url;
|
10
|
+
url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString.slice(1);
|
11
|
+
}
|
12
|
+
return url;
|
13
|
+
};
|
14
|
+
// fetch api stuff
|
15
|
+
const requestWithFetch = (options, url, payload, callback) => {
|
16
|
+
if (options.queryStringParams) {
|
17
|
+
url = addQueryString(url, options.queryStringParams);
|
18
|
+
}
|
19
|
+
const headers = typeof options.customHeaders === 'function' ? options.customHeaders() : options.customHeaders;
|
20
|
+
if (payload)
|
21
|
+
headers['Content-Type'] = 'application/json';
|
22
|
+
fetch(url, {
|
23
|
+
...(typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions),
|
24
|
+
method: payload ? 'POST' : 'GET',
|
25
|
+
body: payload ? options.stringify(payload) : undefined,
|
26
|
+
headers
|
27
|
+
})
|
28
|
+
.then(response => {
|
29
|
+
if (!response.ok)
|
30
|
+
return callback(response.statusText || 'Error', { status: response.status });
|
31
|
+
response
|
32
|
+
.text()
|
33
|
+
.then(data => {
|
34
|
+
callback(null, { status: response.status, data });
|
35
|
+
})
|
36
|
+
.catch(callback);
|
37
|
+
})
|
38
|
+
.catch(callback);
|
39
|
+
};
|
40
|
+
export const request = (options, url, payload, callback) => {
|
41
|
+
if (typeof payload === 'function') {
|
42
|
+
callback = payload;
|
43
|
+
payload = undefined;
|
44
|
+
}
|
45
|
+
return requestWithFetch(options, url, payload, callback || (() => { }));
|
46
|
+
};
|
47
|
+
//# sourceMappingURL=request.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/http-backend/request.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,MAAW,EAAE,EAAE;IAClD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACxC,IAAI,WAAW,GAAG,EAAE,CAAA;QACpB,mBAAmB;QACnB,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE;YAC9B,WAAW,IAAI,GAAG,GAAG,kBAAkB,CAAC,SAAS,CAAC,GAAG,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,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AAU,IAAI,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;QAC9F,QAAQ;aACL,IAAI,EAAE;aACN,IAAI,CAAC,IAAI,CAAC,EAAE;YACX,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;QACnD,CAAC,CAAC;aACD,KAAK,CAAC,QAAQ,CAAC,CAAA;IACpB,CAAC,CAAC;SACD,KAAK,CAAC,QAAQ,CAAC,CAAA;AACpB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,OAAY,EACZ,GAAQ,EACR,OAAY,EACZ,QAA2D,EAC3D,EAAE;IACF,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;QACjC,QAAQ,GAAG,OAAO,CAAA;QAClB,OAAO,GAAG,SAAS,CAAA;KACpB;IAED,OAAO,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAA;AACxE,CAAC,CAAA","sourcesContent":["const addQueryString = (url: string, params: any) => {\n if (params && typeof params === 'object') {\n let queryString = ''\n // Must encode data\n for (const paramName in params) {\n queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName])\n }\n if (!queryString) return url\n url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString.slice(1)\n }\n\n return url\n}\n\n// fetch api stuff\nconst requestWithFetch = (options: any, url: any, payload: any, callback: (status: any, obj?: any) => void) => {\n if (options.queryStringParams) {\n url = addQueryString(url, options.queryStringParams)\n }\n const headers = typeof options.customHeaders === 'function' ? options.customHeaders() : options.customHeaders\n\n if (payload) headers['Content-Type'] = 'application/json'\n fetch(url, {\n ...(typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions),\n method: payload ? 'POST' : 'GET',\n body: payload ? options.stringify(payload) : undefined,\n headers\n })\n .then(response => {\n if (!response.ok) return callback(response.statusText || 'Error', { status: response.status })\n response\n .text()\n .then(data => {\n callback(null, { status: response.status, data })\n })\n .catch(callback)\n })\n .catch(callback)\n}\n\nexport const request = (\n options: any,\n url: any,\n payload: any,\n callback: (status: string, obj: { status: number }) => void\n) => {\n if (typeof payload === 'function') {\n callback = payload\n payload = undefined\n }\n\n return requestWithFetch(options, url, payload, callback || (() => {}))\n}\n"]}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Determine whether the given `maybePromise` is a Promise.
|
3
|
+
*
|
4
|
+
* @param {*} maybePromise
|
5
|
+
*
|
6
|
+
* @returns {Boolean}
|
7
|
+
*/
|
8
|
+
function isPromise(maybePromise) {
|
9
|
+
return !!maybePromise && typeof maybePromise.then === 'function';
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* Convert any value to a Promise than will resolve to this value.
|
13
|
+
*
|
14
|
+
* @param {*} maybePromise
|
15
|
+
*
|
16
|
+
* @returns {Promise}
|
17
|
+
*/
|
18
|
+
export function makePromise(maybePromise) {
|
19
|
+
if (isPromise(maybePromise)) {
|
20
|
+
return maybePromise;
|
21
|
+
}
|
22
|
+
return Promise.resolve(maybePromise);
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/http-backend/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,YAAiB;IAClC,OAAO,CAAC,CAAC,YAAY,IAAI,OAAO,YAAY,CAAC,IAAI,KAAK,UAAU,CAAA;AAClE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,YAAiB;IAC3C,IAAI,SAAS,CAAC,YAAY,CAAC,EAAE;QAC3B,OAAO,YAAY,CAAA;KACpB;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;AACtC,CAAC","sourcesContent":["/**\n * Determine whether the given `maybePromise` is a Promise.\n *\n * @param {*} maybePromise\n *\n * @returns {Boolean}\n */\nfunction isPromise(maybePromise: any) {\n return !!maybePromise && typeof maybePromise.then === 'function'\n}\n\n/**\n * Convert any value to a Promise than will resolve to this value.\n *\n * @param {*} maybePromise\n *\n * @returns {Promise}\n */\nexport function makePromise(maybePromise: any) {\n if (isPromise(maybePromise)) {\n return maybePromise\n }\n\n return Promise.resolve(maybePromise)\n}\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/tslib/tslib.d.ts","../../../node_modules/i18next/index.d.ts","../../../node_modules/i18next-browser-languagedetector/index.d.ts","../../../node_modules/i18next-http-backend/index.d.ts","../src/config.ts","../../../node_modules/@lit/reactive-element/css-tag.d.ts","../../../node_modules/@lit/reactive-element/reactive-controller.d.ts","../../../node_modules/@lit/reactive-element/reactive-element.d.ts","../../../node_modules/@types/trusted-types/lib/index.d.ts","../../../node_modules/@types/trusted-types/index.d.ts","../../../node_modules/lit-html/directive.d.ts","../../../node_modules/lit-html/lit-html.d.ts","../../../node_modules/lit-element/lit-element.d.ts","../../../node_modules/lit/index.d.ts","../src/localize.ts","../../../node_modules/@lit/reactive-element/decorators/base.d.ts","../../../node_modules/@lit/reactive-element/decorators/custom-element.d.ts","../../../node_modules/@lit/reactive-element/decorators/property.d.ts","../../../node_modules/@lit/reactive-element/decorators/state.d.ts","../../../node_modules/@lit/reactive-element/decorators/event-options.d.ts","../../../node_modules/@lit/reactive-element/decorators/query.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-all.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-async.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts","../../../node_modules/lit/decorators.d.ts","../src/ox-i18n.ts","../src/ox-i18n-selector.ts","../src/index.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/mocha/index.d.ts"],"fileInfos":[{"version":"3ac1b83264055b28c0165688fda6dfcc39001e9e7828f649299101c23ad0a0c3","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"72704b10d97777e15f1a581b73f88273037ef752d2e50b72287bd0a90af64fe6","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"5075b36ab861c8c0c45377cb8c96270d7c65f0eeaf105d53fac6850da61f1027","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},"12f4cfe2fe60b810c3174537bc2ddb20c1067b7768643d12cb1266fd183afb75","5d8a54affc9a33b29830ad949f6e247314cbb7f85287231b07b66611bacf795f","332bd67a6233b14fd19c10d14110b12e5eea53ffe4a3a54e1eaf3c933e69d0e6","5fea664bb9db0da2781f8b89fd560bc93e70405caedb5099c9ec7c14b45cc026","035a263825cd9c1d965ce5062a6c5c0ecb7bf28699671deb659fac3c362c2ea7","6e2c5a9358c2be6791713f778c3af2d3357b8665d881e22f50b3aa861a2a9717","1e5743b25a63fd34ffbae89adcbf248ee17db6ed08d90079ffa93803c3e80d2a","13bb750b495c48fd60d7b5e09f65d4a7b010ab7e09a8943a6d54511e7d184f84","2fcd2d22b1f30555e785105597cd8f57ed50300e213c4f1bbca6ae149f782c38",{"version":"bb4248c7f953233ac52332088fac897d62b82be07244e551d87c5049600b6cf7","affectsGlobalScope":true},"70f04c91d3186b1b10157157887fab664968fc9b88377785a5ee42750c202c6d","f690af1a7043e58fce8c672df5e1d1e27bad7459b81143af991db7c5427a0785","eba7cf33380cc3a3cf614faf67300e14d0bdff9ea6c5cd6f4b040b1756a48ab1","f07a77a7fb1d49aa2b61cb68bf712a083487acd7130d20223a83de03af0c257d","17959d175ba42127b555b990fb6ded437889f84d87c0ad446bd916ec3b06571f","97c58f6db61d45712d91d2260994817ae2b568bbb37cc280013079b6b5d2232d","ac388c7c7a262213a3700451bc921e382a93fb27c0252c34ccf03540b4ce044b","1da789e534bc558808021dd64abf33a91a68e422bbf28aeec236bd74df640401","fb0107c83e2e0e75b77dacd0c3c6c3ab6844e98dce2a8f858c6f0a57c12136a6","0a478dcb6e6bd8a5d871165659c79cee7b8c3b7a87289118d22e1a04d171e252","a25d1e52291791819032826af5c52987e16ffdb96e8bb69f7f1790f5ab080be6","d660961abada6b5030461f3322ef3a2e1d9fec74167574f8b590a7796cf90a72","707b4eae3d469b2f347d2083037151922f94c370a9456ebd5ac0a4fb7441c7e7","4bcb813ea56182beaaab1e8274524eb9f1449b0d8e79efc4a0399de09e43f816","c784eab1cf838d9d6527bce3d9f2d373145606666b68f7610291a7adf6e6bda9","f0380f581cb015778c0fe51e95b5b7f6dae237280654558469b2486c1572268a","0b155b082e005c680a4fd252b75972d15a877d980a615d39465c34837e1d9e04","8e4f832863973334a65e5ad95eb7aba8c65e314b0eded637ddd9af3c12a5f7ef","78a7a8d9a4d91c923ae1b5182823979f2856247b5008181f6254aff23356e61c","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"c2ab70bbc7a24c42a790890739dd8a0ba9d2e15038b40dff8163a97a5d148c00","affectsGlobalScope":true},"422dbb183fdced59425ca072c8bd09efaa77ce4e2ab928ec0d8a1ce062d2a45a",{"version":"712ba0d43b44d144dfd01593f61af6e2e21cfae83e834d297643e7973e55ed61","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","98a3ebfa494b46265634a73459050befba5da8fdc6ca0ef9b7269421780f4ff3","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","cc0b61316c4f37393f1f9595e93b673f4184e9d07f4c127165a490ec4a928668","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"7a5459efa09ea82088234e6533a203d528c594b01787fb90fba148885a36e8b6","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","ad41bb744149e92adb06eb953da195115620a3f2ad48e7d3ae04d10762dae197","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"5d0a9ea09d990b5788f867f1c79d4878f86f7384cb7dab38eecbf22f9efd063d","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"4cd4cff679c9b3d9239fd7bf70293ca4594583767526916af8e5d5a47d0219c7","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"3345c276cab0e76dda86c0fb79104ff915a4580ba0f3e440870e183b1baec476","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","e383ff72aabf294913f8c346f5da1445ae6ad525836d28efd52cbadc01a361a6","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"9cafe917bf667f1027b2bb62e2de454ecd2119c80873ad76fc41d941089753b8",{"version":"5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./","rootDir":"..","sourceMap":true,"strict":true,"target":5,"useDefineForClassFields":false},"fileIdsList":[[112],[47,112],[55,112],[47,55,112],[47,55,63,112],[45,46,112],[69,112],[72,112],[73,78,112],[74,84,85,92,101,111,112],[74,75,84,92,112],[76,112],[77,78,85,93,112],[78,101,108,112],[79,81,84,92,112],[80,112],[81,82,112],[83,84,112],[84,112],[84,85,86,101,111,112],[84,85,86,101,112],[87,92,101,111,112],[84,85,87,88,92,101,108,111,112],[87,89,101,108,111,112],[69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118],[84,90,112],[91,111,112],[81,84,92,101,112],[93,112],[94,112],[72,95,112],[96,110,112,116],[97,112],[98,112],[84,99,112],[99,100,112,114],[84,101,102,103,112],[101,103,112],[101,102,112],[104,112],[105,112],[84,106,107,112],[106,107,112],[78,92,101,108,112],[109,112],[92,110,112],[73,87,98,111,112],[78,112],[101,112,113],[112,114],[112,115],[73,78,84,86,95,101,111,112,114,116],[101,112,117],[48,112],[41,42,43,112],[47,51,112],[51,112],[49,50,112],[56,57,58,59,60,61,62,63,64,112],[47,51,52,112],[40,41,42,43,112],[40,44,54,66,67,112],[40,41,42,43,53,112],[40,44,53,65,112],[40,44,53,54,65,112]],"referencedMap":[[45,1],[55,2],[56,3],[59,4],[57,4],[61,4],[64,5],[63,1],[62,4],[60,4],[58,3],[46,1],[47,6],[120,1],[69,7],[70,7],[72,8],[73,9],[74,10],[75,11],[76,12],[77,13],[78,14],[79,15],[80,16],[81,17],[82,17],[83,18],[84,19],[85,20],[86,21],[71,1],[118,1],[87,22],[88,23],[89,24],[119,25],[90,26],[91,27],[92,28],[93,29],[94,30],[95,31],[96,32],[97,33],[98,34],[99,35],[100,36],[101,37],[103,38],[102,39],[104,40],[105,41],[106,42],[107,43],[108,44],[109,45],[110,46],[111,47],[112,48],[113,49],[114,50],[115,51],[116,52],[117,53],[49,54],[48,1],[42,55],[43,55],[41,1],[52,56],[50,57],[51,58],[65,59],[53,60],[40,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[44,61],[68,62],[54,63],[67,64],[66,65]],"exportedModulesMap":[[45,1],[55,2],[56,3],[59,4],[57,4],[61,4],[64,5],[63,1],[62,4],[60,4],[58,3],[46,1],[47,6],[120,1],[69,7],[70,7],[72,8],[73,9],[74,10],[75,11],[76,12],[77,13],[78,14],[79,15],[80,16],[81,17],[82,17],[83,18],[84,19],[85,20],[86,21],[71,1],[118,1],[87,22],[88,23],[89,24],[119,25],[90,26],[91,27],[92,28],[93,29],[94,30],[95,31],[96,32],[97,33],[98,34],[99,35],[100,36],[101,37],[103,38],[102,39],[104,40],[105,41],[106,42],[107,43],[108,44],[109,45],[110,46],[111,47],[112,48],[113,49],[114,50],[115,51],[116,52],[117,53],[49,54],[48,1],[42,55],[43,55],[41,1],[52,56],[50,57],[51,58],[65,59],[53,60],[40,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[44,61],[68,62],[54,63],[67,64],[66,65]],"semanticDiagnosticsPerFile":[45,55,56,59,57,61,64,63,62,60,58,46,47,120,69,70,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,71,118,87,88,89,119,90,91,92,93,94,95,96,97,98,99,100,101,103,102,104,105,106,107,108,109,110,111,112,113,114,115,116,117,49,48,42,43,41,52,50,51,65,53,40,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,38,34,35,36,37,1,39,44,68,54,67,66]},"version":"4.6.2"}
|
1
|
+
{"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/tslib/tslib.d.ts","../../../node_modules/i18next/index.d.ts","../src/http-backend/utils.ts","../src/http-backend/request.ts","../src/http-backend/index.ts","../../../node_modules/i18next-browser-languagedetector/index.d.ts","../src/config.ts","../../../node_modules/@lit/reactive-element/css-tag.d.ts","../../../node_modules/@lit/reactive-element/reactive-controller.d.ts","../../../node_modules/@lit/reactive-element/reactive-element.d.ts","../../../node_modules/@types/trusted-types/lib/index.d.ts","../../../node_modules/@types/trusted-types/index.d.ts","../../../node_modules/lit-html/directive.d.ts","../../../node_modules/lit-html/lit-html.d.ts","../../../node_modules/lit-element/lit-element.d.ts","../../../node_modules/lit/index.d.ts","../src/localize.ts","../../../node_modules/@lit/reactive-element/decorators/base.d.ts","../../../node_modules/@lit/reactive-element/decorators/custom-element.d.ts","../../../node_modules/@lit/reactive-element/decorators/property.d.ts","../../../node_modules/@lit/reactive-element/decorators/state.d.ts","../../../node_modules/@lit/reactive-element/decorators/event-options.d.ts","../../../node_modules/@lit/reactive-element/decorators/query.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-all.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-async.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts","../../../node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts","../../../node_modules/lit/decorators.d.ts","../src/ox-i18n.ts","../src/ox-i18n-selector.ts","../src/index.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/mocha/index.d.ts"],"fileInfos":[{"version":"3ac1b83264055b28c0165688fda6dfcc39001e9e7828f649299101c23ad0a0c3","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940",{"version":"72704b10d97777e15f1a581b73f88273037ef752d2e50b72287bd0a90af64fe6","affectsGlobalScope":true},{"version":"d8996609230d17e90484a2dd58f22668f9a05a3bfe00bfb1d6271171e54a31fb","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"5075b36ab861c8c0c45377cb8c96270d7c65f0eeaf105d53fac6850da61f1027","affectsGlobalScope":true},{"version":"10bbdc1981b8d9310ee75bfac28ee0477bb2353e8529da8cff7cb26c409cb5e8","affectsGlobalScope":true},"12f4cfe2fe60b810c3174537bc2ddb20c1067b7768643d12cb1266fd183afb75","5d8a54affc9a33b29830ad949f6e247314cbb7f85287231b07b66611bacf795f","92fdaed0fdc293ad093ae04e4eab62b6e1217b40f2eb1692b14ac3e7f846bc9f","449c94b0cbf0c2050aff7660c9bf54b5cae1863c5e39243230a0e92d264ff430","fcbf17d2351b1f97a214af78bf57a8c9f62b07aa1635ff0284429144eabeb170","332bd67a6233b14fd19c10d14110b12e5eea53ffe4a3a54e1eaf3c933e69d0e6","e75f5d5769c09e22041a6a92ae165ce797d8da0eb1dacc1b4cbfd3d86d477f43","6e2c5a9358c2be6791713f778c3af2d3357b8665d881e22f50b3aa861a2a9717","1e5743b25a63fd34ffbae89adcbf248ee17db6ed08d90079ffa93803c3e80d2a","13bb750b495c48fd60d7b5e09f65d4a7b010ab7e09a8943a6d54511e7d184f84","2fcd2d22b1f30555e785105597cd8f57ed50300e213c4f1bbca6ae149f782c38",{"version":"bb4248c7f953233ac52332088fac897d62b82be07244e551d87c5049600b6cf7","affectsGlobalScope":true},"70f04c91d3186b1b10157157887fab664968fc9b88377785a5ee42750c202c6d","f690af1a7043e58fce8c672df5e1d1e27bad7459b81143af991db7c5427a0785","eba7cf33380cc3a3cf614faf67300e14d0bdff9ea6c5cd6f4b040b1756a48ab1","f07a77a7fb1d49aa2b61cb68bf712a083487acd7130d20223a83de03af0c257d","17959d175ba42127b555b990fb6ded437889f84d87c0ad446bd916ec3b06571f","97c58f6db61d45712d91d2260994817ae2b568bbb37cc280013079b6b5d2232d","ac388c7c7a262213a3700451bc921e382a93fb27c0252c34ccf03540b4ce044b","1da789e534bc558808021dd64abf33a91a68e422bbf28aeec236bd74df640401","fb0107c83e2e0e75b77dacd0c3c6c3ab6844e98dce2a8f858c6f0a57c12136a6","0a478dcb6e6bd8a5d871165659c79cee7b8c3b7a87289118d22e1a04d171e252","a25d1e52291791819032826af5c52987e16ffdb96e8bb69f7f1790f5ab080be6","d660961abada6b5030461f3322ef3a2e1d9fec74167574f8b590a7796cf90a72","707b4eae3d469b2f347d2083037151922f94c370a9456ebd5ac0a4fb7441c7e7","4bcb813ea56182beaaab1e8274524eb9f1449b0d8e79efc4a0399de09e43f816","c784eab1cf838d9d6527bce3d9f2d373145606666b68f7610291a7adf6e6bda9","f0380f581cb015778c0fe51e95b5b7f6dae237280654558469b2486c1572268a","0b155b082e005c680a4fd252b75972d15a877d980a615d39465c34837e1d9e04","8e4f832863973334a65e5ad95eb7aba8c65e314b0eded637ddd9af3c12a5f7ef","78a7a8d9a4d91c923ae1b5182823979f2856247b5008181f6254aff23356e61c","0cba3a5d7b81356222594442753cf90dd2892e5ccfe1d262aaca6896ba6c1380","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"c2ab70bbc7a24c42a790890739dd8a0ba9d2e15038b40dff8163a97a5d148c00","affectsGlobalScope":true},"422dbb183fdced59425ca072c8bd09efaa77ce4e2ab928ec0d8a1ce062d2a45a",{"version":"712ba0d43b44d144dfd01593f61af6e2e21cfae83e834d297643e7973e55ed61","affectsGlobalScope":true},"1dab5ab6bcf11de47ab9db295df8c4f1d92ffa750e8f095e88c71ce4c3299628","f71f46ccd5a90566f0a37b25b23bc4684381ab2180bdf6733f4e6624474e1894",{"version":"54e65985a3ee3cec182e6a555e20974ea936fc8b8d1738c14e8ed8a42bd921d4","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","98a3ebfa494b46265634a73459050befba5da8fdc6ca0ef9b7269421780f4ff3","34e5de87d983bc6aefef8b17658556e3157003e8d9555d3cb098c6bef0b5fbc8","cc0b61316c4f37393f1f9595e93b673f4184e9d07f4c127165a490ec4a928668","f27371653aded82b2b160f7a7033fb4a5b1534b6f6081ef7be1468f0f15327d3","c762cd6754b13a461c54b59d0ae0ab7aeef3c292c6cf889873f786ee4d8e75c9","f4ea7d5df644785bd9fbf419930cbaec118f0d8b4160037d2339b8e23c059e79",{"version":"bfea28e6162ed21a0aeed181b623dcf250aa79abf49e24a6b7e012655af36d81","affectsGlobalScope":true},"7a5459efa09ea82088234e6533a203d528c594b01787fb90fba148885a36e8b6","ae97e20f2e10dbeec193d6a2f9cd9a367a1e293e7d6b33b68bacea166afd7792","10d4796a130577d57003a77b95d8723530bbec84718e364aa2129fa8ffba0378","ad41bb744149e92adb06eb953da195115620a3f2ad48e7d3ae04d10762dae197","bf73c576885408d4a176f44a9035d798827cc5020d58284cb18d7573430d9022","7ae078ca42a670445ae0c6a97c029cb83d143d62abd1730efb33f68f0b2c0e82",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"5d0a9ea09d990b5788f867f1c79d4878f86f7384cb7dab38eecbf22f9efd063d","12eea70b5e11e924bb0543aea5eadc16ced318aa26001b453b0d561c2fd0bd1e","08777cd9318d294646b121838574e1dd7acbb22c21a03df84e1f2c87b1ad47f2","08a90bcdc717df3d50a2ce178d966a8c353fd23e5c392fd3594a6e39d9bb6304",{"version":"4cd4cff679c9b3d9239fd7bf70293ca4594583767526916af8e5d5a47d0219c7","affectsGlobalScope":true},"2a12d2da5ac4c4979401a3f6eaafa874747a37c365e4bc18aa2b171ae134d21b","002b837927b53f3714308ecd96f72ee8a053b8aeb28213d8ec6de23ed1608b66","1dc9c847473bb47279e398b22c740c83ea37a5c88bf66629666e3cf4c5b9f99c","a9e4a5a24bf2c44de4c98274975a1a705a0abbaad04df3557c2d3cd8b1727949","00fa7ce8bc8acc560dc341bbfdf37840a8c59e6a67c9bfa3fa5f36254df35db2","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff",{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true},"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","5f0ed51db151c2cdc4fa3bb0f44ce6066912ad001b607a34e65a96c52eb76248",{"version":"3345c276cab0e76dda86c0fb79104ff915a4580ba0f3e440870e183b1baec476","affectsGlobalScope":true},"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","e383ff72aabf294913f8c346f5da1445ae6ad525836d28efd52cbadc01a361a6","f52fbf64c7e480271a9096763c4882d356b05cab05bf56a64e68a95313cd2ce2","59bdb65f28d7ce52ccfc906e9aaf422f8b8534b2d21c32a27d7819be5ad81df7",{"version":"3a2da34079a2567161c1359316a32e712404b56566c45332ac9dcee015ecce9f","affectsGlobalScope":true},"28a2e7383fd898c386ffdcacedf0ec0845e5d1a86b5a43f25b86bc315f556b79","3aff9c8c36192e46a84afe7b926136d520487155154ab9ba982a8b544ea8fc95","a880cf8d85af2e4189c709b0fea613741649c0e40fffb4360ec70762563d5de0","85bbf436a15bbeda4db888be3062d47f99c66fd05d7c50f0f6473a9151b6a070","9f9c49c95ecd25e0cb2587751925976cf64fd184714cb11e213749c80cf0f927","f0c75c08a71f9212c93a719a25fb0320d53f2e50ca89a812640e08f8ad8c408c",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"9cafe917bf667f1027b2bb62e2de454ecd2119c80873ad76fc41d941089753b8",{"version":"5f186a758a616c107c70e8918db4630d063bd782f22e6e0b17573b125765b40b","affectsGlobalScope":true}],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitOnError":true,"outDir":"./","rootDir":"..","sourceMap":true,"strict":true,"target":5,"useDefineForClassFields":false},"fileIdsList":[[114],[49,114],[57,114],[49,57,114],[49,57,65,114],[47,48,114],[71,114],[74,114],[75,80,114],[76,86,87,94,103,113,114],[76,77,86,94,114],[78,114],[79,80,87,95,114],[80,103,110,114],[81,83,86,94,114],[82,114],[83,84,114],[85,86,114],[86,114],[86,87,88,103,113,114],[86,87,88,103,114],[89,94,103,113,114],[86,87,89,90,94,103,110,113,114],[89,91,103,110,113,114],[71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120],[86,92,114],[93,113,114],[83,86,94,103,114],[95,114],[96,114],[74,97,114],[98,112,114,118],[99,114],[100,114],[86,101,114],[101,102,114,116],[86,103,104,105,114],[103,105,114],[103,104,114],[106,114],[107,114],[86,108,109,114],[108,109,114],[80,94,103,110,114],[111,114],[94,112,114],[75,89,100,113,114],[80,114],[103,114,115],[114,116],[114,117],[75,80,86,88,97,103,113,114,116,118],[103,114,119],[50,114],[41,45,114],[49,53,114],[53,114],[51,52,114],[58,59,60,61,62,63,64,65,66,114],[49,53,54,114],[40,41,44,45,114],[40,41,42,43,45,114],[40,114],[40,46,56,68,69,114],[40,41,45,55,114],[40,46,55,67,114],[40,46,55,56,67,114]],"referencedMap":[[47,1],[57,2],[58,3],[61,4],[59,4],[63,4],[66,5],[65,1],[64,4],[62,4],[60,3],[48,1],[49,6],[122,1],[71,7],[72,7],[74,8],[75,9],[76,10],[77,11],[78,12],[79,13],[80,14],[81,15],[82,16],[83,17],[84,17],[85,18],[86,19],[87,20],[88,21],[73,1],[120,1],[89,22],[90,23],[91,24],[121,25],[92,26],[93,27],[94,28],[95,29],[96,30],[97,31],[98,32],[99,33],[100,34],[101,35],[102,36],[103,37],[105,38],[104,39],[106,40],[107,41],[108,42],[109,43],[110,44],[111,45],[112,46],[113,47],[114,48],[115,49],[116,50],[117,51],[118,52],[119,53],[51,54],[50,1],[45,55],[41,1],[54,56],[52,57],[53,58],[67,59],[55,60],[40,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[46,61],[44,62],[43,63],[42,63],[70,64],[56,65],[69,66],[68,67]],"exportedModulesMap":[[47,1],[57,2],[58,3],[61,4],[59,4],[63,4],[66,5],[65,1],[64,4],[62,4],[60,3],[48,1],[49,6],[122,1],[71,7],[72,7],[74,8],[75,9],[76,10],[77,11],[78,12],[79,13],[80,14],[81,15],[82,16],[83,17],[84,17],[85,18],[86,19],[87,20],[88,21],[73,1],[120,1],[89,22],[90,23],[91,24],[121,25],[92,26],[93,27],[94,28],[95,29],[96,30],[97,31],[98,32],[99,33],[100,34],[101,35],[102,36],[103,37],[105,38],[104,39],[106,40],[107,41],[108,42],[109,43],[110,44],[111,45],[112,46],[113,47],[114,48],[115,49],[116,50],[117,51],[118,52],[119,53],[51,54],[50,1],[45,55],[41,1],[54,56],[52,57],[53,58],[67,59],[55,60],[40,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[30,1],[31,1],[32,1],[33,1],[7,1],[38,1],[34,1],[35,1],[36,1],[37,1],[1,1],[39,1],[46,61],[44,62],[43,63],[42,63],[70,64],[56,65],[69,66],[68,67]],"semanticDiagnosticsPerFile":[47,57,58,61,59,63,66,65,64,62,60,48,49,122,71,72,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,73,120,89,90,91,121,92,93,94,95,96,97,98,99,100,101,102,103,105,104,106,107,108,109,110,111,112,113,114,115,116,117,118,119,51,50,45,41,54,52,53,67,55,40,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,30,31,32,33,7,38,34,35,36,37,1,39,46,44,43,42,70,56,69,68]},"version":"4.6.2"}
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent i18n following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "heartyoh",
|
6
|
-
"version": "1.0.0-alpha.
|
6
|
+
"version": "1.0.0-alpha.20",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"module": "dist/src/index.js",
|
9
9
|
"exports": {
|
@@ -38,7 +38,6 @@
|
|
38
38
|
"@web/dev-server-esbuild": "^0.2.16",
|
39
39
|
"i18next": "^21.6.10",
|
40
40
|
"i18next-browser-languagedetector": "^6.1.3",
|
41
|
-
"i18next-http-backend": "^1.3.2",
|
42
41
|
"lit": "^2.2.0"
|
43
42
|
},
|
44
43
|
"devDependencies": {
|
@@ -73,5 +72,5 @@
|
|
73
72
|
"prettier --write"
|
74
73
|
]
|
75
74
|
},
|
76
|
-
"gitHead": "
|
75
|
+
"gitHead": "5dfb4809dcd75e15b2ccc1af713d0977a1840e7e"
|
77
76
|
}
|
package/src/config.ts
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import
|
5
|
+
// import Backend from 'i18next-http-backend'
|
6
|
+
import { Backend } from './http-backend'
|
6
7
|
import LngDetector from 'i18next-browser-languagedetector'
|
7
|
-
import
|
8
|
+
import _i18next from 'i18next'
|
8
9
|
|
9
|
-
|
10
|
+
_i18next
|
10
11
|
.use(LngDetector)
|
11
|
-
.use(
|
12
|
+
.use(Backend)
|
12
13
|
.init({
|
13
14
|
fallbackLng: 'en',
|
14
15
|
debug: true,
|
@@ -39,4 +40,4 @@ i18next
|
|
39
40
|
}
|
40
41
|
})
|
41
42
|
|
42
|
-
export
|
43
|
+
export const i18next = _i18next
|
@@ -0,0 +1,167 @@
|
|
1
|
+
// migrated from https://github.com/i18next/i18next-http-backend
|
2
|
+
// due to import module problem
|
3
|
+
|
4
|
+
import { ModuleType } from 'i18next'
|
5
|
+
import { makePromise } from './utils.js'
|
6
|
+
import { request } from './request.js'
|
7
|
+
|
8
|
+
const getDefaults = () => {
|
9
|
+
return {
|
10
|
+
loadPath: '/locales/{{lng}}/{{ns}}.json',
|
11
|
+
addPath: '/locales/add/{{lng}}/{{ns}}',
|
12
|
+
allowMultiLoading: false,
|
13
|
+
parse: (data: any) => JSON.parse(data),
|
14
|
+
stringify: JSON.stringify,
|
15
|
+
parsePayload: (namespace: any, key: string, fallbackValue: any) => ({ [key]: fallbackValue || '' }),
|
16
|
+
request,
|
17
|
+
reloadInterval: typeof window !== 'undefined' ? false : 60 * 60 * 1000,
|
18
|
+
customHeaders: {},
|
19
|
+
queryStringParams: {},
|
20
|
+
crossDomain: false, // used for XmlHttpRequest
|
21
|
+
withCredentials: false, // used for XmlHttpRequest
|
22
|
+
overrideMimeType: false, // used for XmlHttpRequest
|
23
|
+
requestOptions: {
|
24
|
+
// used for fetch
|
25
|
+
mode: 'cors',
|
26
|
+
credentials: 'same-origin',
|
27
|
+
cache: 'default'
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
export class Backend {
|
33
|
+
static type: ModuleType = 'backend'
|
34
|
+
|
35
|
+
services: any
|
36
|
+
options: any
|
37
|
+
allOptions: any
|
38
|
+
type: string
|
39
|
+
|
40
|
+
constructor(services: any, options: any = {}, allOptions: any = {}) {
|
41
|
+
this.services = services
|
42
|
+
this.options = options
|
43
|
+
this.allOptions = allOptions
|
44
|
+
this.type = 'backend'
|
45
|
+
this.init(services, options, allOptions)
|
46
|
+
}
|
47
|
+
|
48
|
+
init(services: any, options: any = {}, allOptions: any = {}) {
|
49
|
+
this.services = services
|
50
|
+
this.options = {
|
51
|
+
...getDefaults(),
|
52
|
+
...this.options,
|
53
|
+
...options
|
54
|
+
}
|
55
|
+
this.allOptions = allOptions
|
56
|
+
if (this.services && this.options.reloadInterval) {
|
57
|
+
setInterval(() => this.reload(), this.options.reloadInterval)
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
readMulti(languages: any, namespaces: any, callback: any) {
|
62
|
+
this._readAny(languages, languages, namespaces, namespaces, callback)
|
63
|
+
}
|
64
|
+
|
65
|
+
read(language: any, namespace: any, callback: any) {
|
66
|
+
this._readAny([language], language, [namespace], namespace, callback)
|
67
|
+
}
|
68
|
+
|
69
|
+
_readAny(languages: any, loadUrlLanguages: any, namespaces: any, loadUrlNamespaces: any, callback: any) {
|
70
|
+
let loadPath = this.options.loadPath
|
71
|
+
if (typeof this.options.loadPath === 'function') {
|
72
|
+
loadPath = this.options.loadPath(languages, namespaces)
|
73
|
+
}
|
74
|
+
|
75
|
+
loadPath = makePromise(loadPath)
|
76
|
+
|
77
|
+
loadPath.then((resolvedLoadPath: any) => {
|
78
|
+
const url = this.services.interpolator.interpolate(resolvedLoadPath, {
|
79
|
+
lng: languages.join('+'),
|
80
|
+
ns: namespaces.join('+')
|
81
|
+
})
|
82
|
+
this.loadUrl(url, callback, loadUrlLanguages, loadUrlNamespaces)
|
83
|
+
})
|
84
|
+
}
|
85
|
+
|
86
|
+
loadUrl(url: string, callback: any, languages: any, namespaces: any) {
|
87
|
+
this.options.request(this.options, url, undefined, (err: any, res: any) => {
|
88
|
+
if (res && ((res.status >= 500 && res.status < 600) || !res.status))
|
89
|
+
return callback('failed loading ' + url + '; status code: ' + res.status, true /* retry */)
|
90
|
+
if (res && res.status >= 400 && res.status < 500)
|
91
|
+
return callback('failed loading ' + url + '; status code: ' + res.status, false /* no retry */)
|
92
|
+
if (!res && err && err.message && err.message.indexOf('Failed to fetch') > -1)
|
93
|
+
return callback('failed loading ' + url + ': ' + err.message, true /* retry */)
|
94
|
+
if (err) return callback(err, false)
|
95
|
+
|
96
|
+
let ret, parseErr
|
97
|
+
try {
|
98
|
+
if (typeof res.data === 'string') {
|
99
|
+
ret = this.options.parse(res.data, languages, namespaces)
|
100
|
+
} else {
|
101
|
+
// fallback, which omits calling the parse function
|
102
|
+
ret = res.data
|
103
|
+
}
|
104
|
+
} catch (e) {
|
105
|
+
parseErr = 'failed parsing ' + url + ' to json'
|
106
|
+
}
|
107
|
+
if (parseErr) return callback(parseErr, false)
|
108
|
+
callback(null, ret)
|
109
|
+
})
|
110
|
+
}
|
111
|
+
|
112
|
+
create(languages: any, namespace: any, key: any, fallbackValue: any, callback: any) {
|
113
|
+
// If there is a falsey addPath, then abort -- this has been disabled.
|
114
|
+
if (!this.options.addPath) return
|
115
|
+
if (typeof languages === 'string') languages = [languages]
|
116
|
+
const payload = this.options.parsePayload(namespace, key, fallbackValue)
|
117
|
+
let finished = 0
|
118
|
+
const dataArray: any = []
|
119
|
+
const resArray: any = []
|
120
|
+
languages.forEach((lng: any) => {
|
121
|
+
let addPath = this.options.addPath
|
122
|
+
if (typeof this.options.addPath === 'function') {
|
123
|
+
addPath = this.options.addPath(lng, namespace)
|
124
|
+
}
|
125
|
+
const url = this.services.interpolator.interpolate(addPath, { lng: lng, ns: namespace })
|
126
|
+
|
127
|
+
this.options.request(this.options, url, payload, (data: any, res: any) => {
|
128
|
+
// TODO: if res.status === 4xx do log
|
129
|
+
finished += 1
|
130
|
+
dataArray.push(data)
|
131
|
+
resArray.push(res)
|
132
|
+
if (finished === languages.length) {
|
133
|
+
if (callback) callback(dataArray, resArray)
|
134
|
+
}
|
135
|
+
})
|
136
|
+
})
|
137
|
+
}
|
138
|
+
|
139
|
+
reload() {
|
140
|
+
const { backendConnector, languageUtils, logger } = this.services
|
141
|
+
const currentLanguage = backendConnector.language
|
142
|
+
if (currentLanguage && currentLanguage.toLowerCase() === 'cimode') return // avoid loading resources for cimode
|
143
|
+
|
144
|
+
const toLoad: any = []
|
145
|
+
const append = (lng: any) => {
|
146
|
+
const lngs = languageUtils.toResolveHierarchy(lng)
|
147
|
+
lngs.forEach((l: any) => {
|
148
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l)
|
149
|
+
})
|
150
|
+
}
|
151
|
+
|
152
|
+
append(currentLanguage)
|
153
|
+
|
154
|
+
if (this.allOptions.preload) this.allOptions.preload.forEach((l: any) => append(l))
|
155
|
+
|
156
|
+
toLoad.forEach((lng: any) => {
|
157
|
+
this.allOptions.ns.forEach((ns: any) => {
|
158
|
+
backendConnector.read(lng, ns, 'read', null, null, (err: any, data: any) => {
|
159
|
+
if (err) logger.warn(`loading namespace ${ns} for language ${lng} failed`, err)
|
160
|
+
if (!err && data) logger.log(`loaded namespace ${ns} for language ${lng}`, data)
|
161
|
+
|
162
|
+
backendConnector.loaded(`${lng}|${ns}`, err, data)
|
163
|
+
})
|
164
|
+
})
|
165
|
+
})
|
166
|
+
}
|
167
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
const addQueryString = (url: string, params: any) => {
|
2
|
+
if (params && typeof params === 'object') {
|
3
|
+
let queryString = ''
|
4
|
+
// Must encode data
|
5
|
+
for (const paramName in params) {
|
6
|
+
queryString += '&' + encodeURIComponent(paramName) + '=' + encodeURIComponent(params[paramName])
|
7
|
+
}
|
8
|
+
if (!queryString) return url
|
9
|
+
url = url + (url.indexOf('?') !== -1 ? '&' : '?') + queryString.slice(1)
|
10
|
+
}
|
11
|
+
|
12
|
+
return url
|
13
|
+
}
|
14
|
+
|
15
|
+
// fetch api stuff
|
16
|
+
const requestWithFetch = (options: any, url: any, payload: any, callback: (status: any, obj?: any) => void) => {
|
17
|
+
if (options.queryStringParams) {
|
18
|
+
url = addQueryString(url, options.queryStringParams)
|
19
|
+
}
|
20
|
+
const headers = typeof options.customHeaders === 'function' ? options.customHeaders() : options.customHeaders
|
21
|
+
|
22
|
+
if (payload) headers['Content-Type'] = 'application/json'
|
23
|
+
fetch(url, {
|
24
|
+
...(typeof options.requestOptions === 'function' ? options.requestOptions(payload) : options.requestOptions),
|
25
|
+
method: payload ? 'POST' : 'GET',
|
26
|
+
body: payload ? options.stringify(payload) : undefined,
|
27
|
+
headers
|
28
|
+
})
|
29
|
+
.then(response => {
|
30
|
+
if (!response.ok) return callback(response.statusText || 'Error', { status: response.status })
|
31
|
+
response
|
32
|
+
.text()
|
33
|
+
.then(data => {
|
34
|
+
callback(null, { status: response.status, data })
|
35
|
+
})
|
36
|
+
.catch(callback)
|
37
|
+
})
|
38
|
+
.catch(callback)
|
39
|
+
}
|
40
|
+
|
41
|
+
export const request = (
|
42
|
+
options: any,
|
43
|
+
url: any,
|
44
|
+
payload: any,
|
45
|
+
callback: (status: string, obj: { status: number }) => void
|
46
|
+
) => {
|
47
|
+
if (typeof payload === 'function') {
|
48
|
+
callback = payload
|
49
|
+
payload = undefined
|
50
|
+
}
|
51
|
+
|
52
|
+
return requestWithFetch(options, url, payload, callback || (() => {}))
|
53
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* Determine whether the given `maybePromise` is a Promise.
|
3
|
+
*
|
4
|
+
* @param {*} maybePromise
|
5
|
+
*
|
6
|
+
* @returns {Boolean}
|
7
|
+
*/
|
8
|
+
function isPromise(maybePromise: any) {
|
9
|
+
return !!maybePromise && typeof maybePromise.then === 'function'
|
10
|
+
}
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Convert any value to a Promise than will resolve to this value.
|
14
|
+
*
|
15
|
+
* @param {*} maybePromise
|
16
|
+
*
|
17
|
+
* @returns {Promise}
|
18
|
+
*/
|
19
|
+
export function makePromise(maybePromise: any) {
|
20
|
+
if (isPromise(maybePromise)) {
|
21
|
+
return maybePromise
|
22
|
+
}
|
23
|
+
|
24
|
+
return Promise.resolve(maybePromise)
|
25
|
+
}
|