@leyyo/localization 1.1.2 → 1.1.3
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/dist/base/base-localization.handler.js +7 -7
- package/dist/base/index.d.ts +2 -2
- package/dist/base/index.js +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -2
- package/dist/config/index.types.d.ts +1 -1
- package/dist/config/localization.config.js +28 -10
- package/dist/country/country.handler.js +1 -1
- package/dist/country/country.map.js +251 -251
- package/dist/country/index.d.ts +2 -2
- package/dist/country/index.js +2 -2
- package/dist/exchange/exchange.handler.js +1 -1
- package/dist/exchange/exchange.map.js +35 -4
- package/dist/exchange/index.d.ts +2 -2
- package/dist/exchange/index.js +2 -2
- package/dist/index.d.ts +11 -11
- package/dist/index.foretell.js +9 -9
- package/dist/index.js +11 -11
- package/dist/index.loader.js +3 -3
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +3 -2
- package/dist/language/index.d.ts +2 -2
- package/dist/language/index.js +2 -2
- package/dist/language/language.handler.js +4 -4
- package/dist/language/language.map.js +184 -184
- package/dist/literal/browser-type.d.ts +1 -1
- package/dist/literal/browser-type.js +1 -9
- package/dist/literal/country-code.d.ts +1 -1
- package/dist/literal/country-code.js +253 -11
- package/dist/literal/cpu-architecture.d.ts +1 -1
- package/dist/literal/cpu-architecture.js +17 -17
- package/dist/literal/device-type.d.ts +1 -1
- package/dist/literal/device-type.js +8 -8
- package/dist/literal/engine-type.d.ts +1 -1
- package/dist/literal/engine-type.js +20 -20
- package/dist/literal/exchange-code.d.ts +1 -1
- package/dist/literal/exchange-code.js +151 -13
- package/dist/literal/index.d.ts +9 -9
- package/dist/literal/index.js +9 -9
- package/dist/literal/language-code.d.ts +1 -1
- package/dist/literal/language-code.js +184 -26
- package/dist/literal/locale-code.d.ts +1 -1
- package/dist/literal/locale-code.js +196 -18
- package/dist/literal/timezone-code.d.ts +1 -1
- package/dist/literal/timezone-code.js +602 -102
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +2 -2
- package/dist/locale/locale.handler.js +5 -5
- package/dist/locale/locale.map.js +83 -83
- package/dist/parser/index.d.ts +2 -2
- package/dist/parser/index.js +2 -2
- package/dist/parser/localization.parser.js +33 -31
- package/dist/timezone/index.d.ts +2 -2
- package/dist/timezone/index.js +2 -2
- package/dist/timezone/timezone.handler.js +8 -1
- package/dist/timezone/timezone.map.js +602 -602
- package/package.json +21 -21
|
@@ -8,34 +8,34 @@ export class BaseLocalizationHandler {
|
|
|
8
8
|
codes;
|
|
9
9
|
/** @inheritDoc */
|
|
10
10
|
has(code) {
|
|
11
|
-
if (typeof code !==
|
|
11
|
+
if (typeof code !== "string") {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
14
|
return this._raw[code] !== undefined;
|
|
15
15
|
}
|
|
16
16
|
/** @inheritDoc */
|
|
17
17
|
getRaw(code) {
|
|
18
|
-
if (typeof code !==
|
|
18
|
+
if (typeof code !== "string") {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
return this._raw[code];
|
|
22
22
|
}
|
|
23
23
|
/** @inheritDoc */
|
|
24
24
|
getName(code) {
|
|
25
|
-
if (typeof code !==
|
|
25
|
+
if (typeof code !== "string") {
|
|
26
26
|
return undefined;
|
|
27
27
|
}
|
|
28
28
|
return this.getRaw(code)?.n ?? code;
|
|
29
29
|
}
|
|
30
30
|
/** @inheritDoc */
|
|
31
31
|
getAll() {
|
|
32
|
-
return this.codes.map(code => this.get(code));
|
|
32
|
+
return this.codes.map((code) => this.get(code));
|
|
33
33
|
}
|
|
34
34
|
/** @inheritDoc */
|
|
35
35
|
getSelected(...codes) {
|
|
36
36
|
return codes
|
|
37
|
-
.filter(code => typeof code ===
|
|
38
|
-
.filter(code => this.codes.includes(code))
|
|
39
|
-
.map(code => this.get(code));
|
|
37
|
+
.filter((code) => typeof code === "string")
|
|
38
|
+
.filter((code) => this.codes.includes(code))
|
|
39
|
+
.map((code) => this.get(code));
|
|
40
40
|
}
|
|
41
41
|
}
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./base-localization.handler.js";
|
package/dist/base/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./base-localization.handler.js";
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./localization.config.js";
|
package/dist/config/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./index.types.js";
|
|
2
|
+
export * from "./localization.config.js";
|
|
@@ -17,4 +17,4 @@ export interface LocalizationConfigLike {
|
|
|
17
17
|
export type ReplacerLike<T extends string, V> = {
|
|
18
18
|
[K in T]?: V;
|
|
19
19
|
};
|
|
20
|
-
export type LocalizationConfigOmit = Omit<LocalizationConfigLike,
|
|
20
|
+
export type LocalizationConfigOmit = Omit<LocalizationConfigLike, "builder">;
|
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { Builder } from "@leyyo/builder";
|
|
2
2
|
class LocalizationConfig {
|
|
3
|
-
authorizationKeys = [
|
|
4
|
-
applicationKeys = [
|
|
5
|
-
correlationKeys = [
|
|
6
|
-
refererKeys = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
authorizationKeys = ["authorization", "api-key"];
|
|
4
|
+
applicationKeys = ["application", "x-application"];
|
|
5
|
+
correlationKeys = ["x-correlation", "x-correlation-id"];
|
|
6
|
+
refererKeys = [
|
|
7
|
+
"x-fwd-referer",
|
|
8
|
+
"x-fwd-referrer",
|
|
9
|
+
"x-referer",
|
|
10
|
+
"x-referrer",
|
|
11
|
+
"referer",
|
|
12
|
+
"referrer",
|
|
13
|
+
];
|
|
14
|
+
userAgentKeys = ["x-fwd-user-agent", "x-user-agent", "user-agent"];
|
|
15
|
+
acceptLanguageKeys = [
|
|
16
|
+
"x-fwd-accept-language",
|
|
17
|
+
"x-accept-language",
|
|
18
|
+
"accept-language",
|
|
19
|
+
];
|
|
20
|
+
ipAddressKeys = [
|
|
21
|
+
"x-real-ip",
|
|
22
|
+
"x-client-ip",
|
|
23
|
+
"fastly-client-ip",
|
|
24
|
+
"true-client-ip",
|
|
25
|
+
"cf-connecting-ip",
|
|
26
|
+
"x-cluster-client-ip",
|
|
27
|
+
"x-forwarded-for",
|
|
28
|
+
];
|
|
29
|
+
applicationDelimiter = ":";
|
|
11
30
|
countryReplacer = {};
|
|
12
31
|
languageReplacer = {};
|
|
13
32
|
localeReplacer = {};
|
|
14
33
|
builder() {
|
|
15
|
-
return Builder.build(this)
|
|
16
|
-
.$setItem((key, value) => {
|
|
34
|
+
return Builder.build(this).$setItem((key, value) => {
|
|
17
35
|
this[key] = value;
|
|
18
36
|
});
|
|
19
37
|
}
|