@leyyo/localization 1.1.1 → 1.1.2
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/README.md +3 -3
- package/dist/base/base-localization.handler.d.ts +1 -1
- package/dist/base/base-localization.handler.js +15 -9
- package/dist/base/index.d.ts +2 -2
- package/dist/base/index.js +2 -19
- package/dist/base/index.types.js +1 -3
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -19
- package/dist/config/index.types.d.ts +2 -4
- package/dist/config/index.types.js +1 -3
- package/dist/config/localization.config.d.ts +1 -1
- package/dist/config/localization.config.js +14 -20
- package/dist/country/country.handler.d.ts +1 -1
- package/dist/country/country.handler.js +12 -22
- package/dist/country/country.map.d.ts +2 -2
- package/dist/country/country.map.js +1 -5
- package/dist/country/index.d.ts +2 -3
- package/dist/country/index.js +2 -20
- package/dist/country/index.types.d.ts +2 -3
- package/dist/country/index.types.js +1 -3
- package/dist/exchange/exchange.handler.d.ts +1 -1
- package/dist/exchange/exchange.handler.js +13 -24
- package/dist/exchange/exchange.map.d.ts +2 -2
- package/dist/exchange/exchange.map.js +1 -5
- package/dist/exchange/index.d.ts +2 -3
- package/dist/exchange/index.js +2 -20
- package/dist/exchange/index.types.d.ts +2 -3
- package/dist/exchange/index.types.js +1 -3
- package/dist/index.d.ts +11 -7
- package/dist/index.foretell.d.ts +1 -0
- package/dist/index.foretell.js +19 -0
- package/dist/index.js +11 -24
- package/dist/index.loader.d.ts +1 -0
- package/dist/index.loader.js +13 -0
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -6
- package/dist/language/index.d.ts +2 -3
- package/dist/language/index.js +2 -20
- package/dist/language/index.types.d.ts +2 -2
- package/dist/language/index.types.js +1 -3
- package/dist/language/language.handler.d.ts +1 -11
- package/dist/language/language.handler.js +9 -17
- package/dist/language/language.map.d.ts +2 -2
- package/dist/language/language.map.js +1 -5
- package/dist/literal/browser-type.d.ts +7 -0
- package/dist/literal/browser-type.js +10 -0
- package/dist/{country → literal}/country-code.js +1 -5
- package/dist/literal/cpu-architecture.d.ts +7 -0
- package/dist/literal/cpu-architecture.js +20 -0
- package/dist/literal/device-type.d.ts +7 -0
- package/dist/literal/device-type.js +11 -0
- package/dist/literal/engine-type.d.ts +7 -0
- package/dist/literal/engine-type.js +23 -0
- package/dist/{exchange → literal}/exchange-code.js +1 -5
- package/dist/literal/index.d.ts +9 -0
- package/dist/literal/index.js +9 -0
- package/dist/{language → literal}/language-code.js +1 -5
- package/dist/{locale → literal}/locale-code.js +1 -5
- package/dist/{timezone → literal}/timezone-code.js +1 -5
- package/dist/locale/index.d.ts +2 -3
- package/dist/locale/index.js +2 -20
- package/dist/locale/index.types.d.ts +2 -4
- package/dist/locale/index.types.js +1 -3
- package/dist/locale/locale.handler.d.ts +1 -17
- package/dist/locale/locale.handler.js +12 -23
- package/dist/locale/locale.map.d.ts +2 -2
- package/dist/locale/locale.map.js +1 -5
- package/dist/parser/index.d.ts +2 -2
- package/dist/parser/index.js +2 -19
- package/dist/parser/index.types.d.ts +4 -24
- package/dist/parser/index.types.js +1 -3
- package/dist/parser/localization.parser.d.ts +1 -1
- package/dist/parser/localization.parser.js +81 -82
- package/dist/timezone/index.d.ts +2 -3
- package/dist/timezone/index.js +2 -20
- package/dist/timezone/index.types.d.ts +2 -3
- package/dist/timezone/index.types.js +1 -3
- package/dist/timezone/timezone.handler.d.ts +1 -1
- package/dist/timezone/timezone.handler.js +14 -24
- package/dist/timezone/timezone.map.d.ts +2 -2
- package/dist/timezone/timezone.map.js +1 -5
- package/package.json +6 -6
- package/dist/base/base-localization.handler.js.map +0 -1
- package/dist/base/index.js.map +0 -1
- package/dist/base/index.types.js.map +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/config/index.types.js.map +0 -1
- package/dist/config/localization.config.js.map +0 -1
- package/dist/country/country-code.js.map +0 -1
- package/dist/country/country.handler.js.map +0 -1
- package/dist/country/country.map.js.map +0 -1
- package/dist/country/index.js.map +0 -1
- package/dist/country/index.types.js.map +0 -1
- package/dist/exchange/exchange-code.js.map +0 -1
- package/dist/exchange/exchange.handler.js.map +0 -1
- package/dist/exchange/exchange.map.js.map +0 -1
- package/dist/exchange/index.js.map +0 -1
- package/dist/exchange/index.types.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/internal.js.map +0 -1
- package/dist/language/index.js.map +0 -1
- package/dist/language/index.types.js.map +0 -1
- package/dist/language/language-code.js.map +0 -1
- package/dist/language/language.handler.js.map +0 -1
- package/dist/language/language.map.js.map +0 -1
- package/dist/locale/index.js.map +0 -1
- package/dist/locale/index.types.js.map +0 -1
- package/dist/locale/locale-code.js.map +0 -1
- package/dist/locale/locale.handler.js.map +0 -1
- package/dist/locale/locale.map.js.map +0 -1
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/index.types.js.map +0 -1
- package/dist/parser/localization.parser.js.map +0 -1
- package/dist/timezone/index.js.map +0 -1
- package/dist/timezone/index.types.js.map +0 -1
- package/dist/timezone/timezone-code.js.map +0 -1
- package/dist/timezone/timezone.handler.js.map +0 -1
- package/dist/timezone/timezone.map.js.map +0 -1
- /package/dist/{country → literal}/country-code.d.ts +0 -0
- /package/dist/{exchange → literal}/exchange-code.d.ts +0 -0
- /package/dist/{language → literal}/language-code.d.ts +0 -0
- /package/dist/{locale → literal}/locale-code.d.ts +0 -0
- /package/dist/{timezone → literal}/timezone-code.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# Leyyo: Localization
|
|
1
|
+
# Leyyo: Localization
|
|
2
2
|
Common library for Leyyo framework
|
|
3
3
|
|
|
4
4
|
## Import
|
|
5
|
-
- `npm i @leyyo/localization
|
|
5
|
+
- `npm i @leyyo/localization`
|
|
6
6
|
|
|
7
7
|
## Usage (Runtime)
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ Common library for Leyyo framework
|
|
|
12
12
|
> @see [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
|
|
13
13
|
>
|
|
14
14
|
```typescript
|
|
15
|
-
import {countryHandler} from "@leyyo/localization
|
|
15
|
+
import {countryHandler} from "@leyyo/localization";
|
|
16
16
|
|
|
17
17
|
/*
|
|
18
18
|
* Country exists
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "./index.types.js";
|
|
2
2
|
/** @inheritDoc */
|
|
3
3
|
export declare abstract class BaseLocalizationHandler<E extends string, W extends BaseLocalizationHandlerView<E>, R extends BaseLocalizationHandlerRaw> implements BaseLocalizationHandlerLike<E, W, R> {
|
|
4
4
|
/**
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseLocalizationHandler = void 0;
|
|
4
1
|
/** @inheritDoc */
|
|
5
|
-
class BaseLocalizationHandler {
|
|
2
|
+
export class BaseLocalizationHandler {
|
|
3
|
+
/**
|
|
4
|
+
* Raw records which is loaded from corresponding map file
|
|
5
|
+
* */
|
|
6
|
+
_raw;
|
|
7
|
+
/** @inheritDoc */
|
|
8
|
+
codes;
|
|
6
9
|
/** @inheritDoc */
|
|
7
10
|
has(code) {
|
|
8
11
|
if (typeof code !== 'string') {
|
|
@@ -19,8 +22,10 @@ class BaseLocalizationHandler {
|
|
|
19
22
|
}
|
|
20
23
|
/** @inheritDoc */
|
|
21
24
|
getName(code) {
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
if (typeof code !== 'string') {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return this.getRaw(code)?.n ?? code;
|
|
24
29
|
}
|
|
25
30
|
/** @inheritDoc */
|
|
26
31
|
getAll() {
|
|
@@ -28,8 +33,9 @@ class BaseLocalizationHandler {
|
|
|
28
33
|
}
|
|
29
34
|
/** @inheritDoc */
|
|
30
35
|
getSelected(...codes) {
|
|
31
|
-
return codes
|
|
36
|
+
return codes
|
|
37
|
+
.filter(code => typeof code === 'string')
|
|
38
|
+
.filter(code => this.codes.includes(code))
|
|
39
|
+
.map(code => this.get(code));
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
|
-
exports.BaseLocalizationHandler = BaseLocalizationHandler;
|
|
35
|
-
//# sourceMappingURL=base-localization.handler.js.map
|
package/dist/base/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './base-localization.handler';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './base-localization.handler.js';
|
package/dist/base/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./base-localization.handler"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './base-localization.handler.js';
|
package/dist/base/index.types.js
CHANGED
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './localization.config';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './localization.config.js';
|
package/dist/config/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./index.types"), exports);
|
|
18
|
-
__exportStar(require("./localization.config"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './localization.config.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LocaleCode } from "../
|
|
3
|
-
import { LanguageCode } from "../language";
|
|
4
|
-
import { CountryCode } from "../country";
|
|
1
|
+
import { BuilderAny } from "@leyyo/builder";
|
|
2
|
+
import { CountryCode, LanguageCode, LocaleCode } from "../literal/index.js";
|
|
5
3
|
export interface LocalizationConfigLike {
|
|
6
4
|
readonly authorizationKeys: string[];
|
|
7
5
|
readonly applicationKeys: string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalizationConfigLike } from "./index.types.js";
|
|
2
2
|
export declare const localizationConfig: LocalizationConfigLike;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localizationConfig = void 0;
|
|
4
|
-
const builder_1 = require("@leyyo/builder");
|
|
1
|
+
import { Builder } from "@leyyo/builder";
|
|
5
2
|
class LocalizationConfig {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.localeReplacer = {};
|
|
18
|
-
}
|
|
3
|
+
authorizationKeys = ['authorization', 'api-key'];
|
|
4
|
+
applicationKeys = ['application', 'x-application'];
|
|
5
|
+
correlationKeys = ['x-correlation', 'x-correlation-id'];
|
|
6
|
+
refererKeys = ['x-fwd-referer', 'x-fwd-referrer', 'x-referer', 'x-referrer', 'referer', 'referrer'];
|
|
7
|
+
userAgentKeys = ['x-fwd-user-agent', 'x-user-agent', 'user-agent'];
|
|
8
|
+
acceptLanguageKeys = ['x-fwd-accept-language', 'x-accept-language', 'accept-language'];
|
|
9
|
+
ipAddressKeys = ['x-real-ip', 'x-client-ip', 'fastly-client-ip', 'true-client-ip', 'cf-connecting-ip', 'x-cluster-client-ip', 'x-forwarded-for'];
|
|
10
|
+
applicationDelimiter = ':';
|
|
11
|
+
countryReplacer = {};
|
|
12
|
+
languageReplacer = {};
|
|
13
|
+
localeReplacer = {};
|
|
19
14
|
builder() {
|
|
20
|
-
return
|
|
15
|
+
return Builder.build(this)
|
|
21
16
|
.$setItem((key, value) => {
|
|
22
17
|
this[key] = value;
|
|
23
18
|
});
|
|
24
19
|
}
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=localization.config.js.map
|
|
21
|
+
export const localizationConfig = new LocalizationConfig();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CountryHandlerLike } from "./index.types.js";
|
|
2
2
|
export declare const countryHandler: CountryHandlerLike;
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const country_code_1 = require("./country-code");
|
|
5
|
-
const country_map_1 = require("./country.map");
|
|
6
|
-
const base_1 = require("../base");
|
|
1
|
+
import { CountryCodeItems } from "../literal/index.js";
|
|
2
|
+
import { countryMap } from "./country.map.js";
|
|
3
|
+
import { BaseLocalizationHandler } from "../base/index.js";
|
|
7
4
|
/** @inheritDoc */
|
|
8
|
-
class CountryHandler extends
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** @inheritDoc */
|
|
14
|
-
this.codes = country_code_1.CountryCodeItems;
|
|
15
|
-
}
|
|
5
|
+
class CountryHandler extends BaseLocalizationHandler {
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
_raw = countryMap;
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
codes = CountryCodeItems;
|
|
16
10
|
/** @inheritDoc */
|
|
17
11
|
getAlpha3(code) {
|
|
18
|
-
|
|
19
|
-
return (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.y;
|
|
12
|
+
return this.getRaw(code)?.y;
|
|
20
13
|
}
|
|
21
14
|
/** @inheritDoc */
|
|
22
15
|
getLanguages(code) {
|
|
23
|
-
|
|
24
|
-
return (_a = this.getRaw(code).l) !== null && _a !== void 0 ? _a : [];
|
|
16
|
+
return this.getRaw(code).l ?? [];
|
|
25
17
|
}
|
|
26
18
|
/** @inheritDoc */
|
|
27
19
|
findByLanguage(languageCode) {
|
|
@@ -38,14 +30,12 @@ class CountryHandler extends base_1.BaseLocalizationHandler {
|
|
|
38
30
|
}
|
|
39
31
|
/** @inheritDoc */
|
|
40
32
|
get(code) {
|
|
41
|
-
var _a;
|
|
42
33
|
const item = this.getRaw(code);
|
|
43
34
|
if (!item) {
|
|
44
35
|
return { code, name: code, alpha3: undefined, languages: [] };
|
|
45
36
|
}
|
|
46
|
-
return { code, name: item.n, alpha3: item.y, languages:
|
|
37
|
+
return { code, name: item.n, alpha3: item.y, languages: item.l ?? [] };
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
// noinspection JSUnusedGlobalSymbols
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=country.handler.js.map
|
|
41
|
+
export const countryHandler = new CountryHandler();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { CountryCode } from "../literal/index.js";
|
|
2
|
+
import { CountryRaw } from "./index.types.js";
|
|
3
3
|
export declare const countryMap: Record<CountryCode, CountryRaw>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.countryMap = void 0;
|
|
4
|
-
exports.countryMap = {
|
|
1
|
+
export const countryMap = {
|
|
5
2
|
AD: { y: 'AND', n: 'Andorra', l: ['ca'] },
|
|
6
3
|
AE: { y: 'ARE', n: 'United Arab Emirates', l: ['ar'] },
|
|
7
4
|
AF: { y: 'AFG', n: 'Afghanistan', l: ['fa', 'ps'] },
|
|
@@ -254,4 +251,3 @@ exports.countryMap = {
|
|
|
254
251
|
ZM: { y: 'ZMB', n: 'Zambia', l: ['en'] },
|
|
255
252
|
ZW: { y: 'ZWE', n: 'Zimbabwe', l: ['en', 'sn', 'nd'] },
|
|
256
253
|
};
|
|
257
|
-
//# sourceMappingURL=country.map.js.map
|
package/dist/country/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './country.handler';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './country.handler.js';
|
package/dist/country/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./country-code"), exports);
|
|
18
|
-
__exportStar(require("./index.types"), exports);
|
|
19
|
-
__exportStar(require("./country.handler"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './country.handler.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base";
|
|
1
|
+
import { CountryCode, LanguageCode } from "../literal/index.js";
|
|
2
|
+
import { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base/index.js";
|
|
4
3
|
/**
|
|
5
4
|
* Country raw format
|
|
6
5
|
* @interface
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ExchangeHandlerLike } from "./index.types.js";
|
|
2
2
|
export declare const exchangeHandler: ExchangeHandlerLike;
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const exchange_code_1 = require("./exchange-code");
|
|
5
|
-
const exchange_map_1 = require("./exchange.map");
|
|
6
|
-
const base_1 = require("../base");
|
|
1
|
+
import { ExchangeCodeItems } from "../literal/index.js";
|
|
2
|
+
import { exchangeMap } from "./exchange.map.js";
|
|
3
|
+
import { BaseLocalizationHandler } from "../base/index.js";
|
|
7
4
|
/** @inheritDoc */
|
|
8
|
-
class ExchangeHandler extends
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** @inheritDoc */
|
|
14
|
-
this.codes = exchange_code_1.ExchangeCodeItems;
|
|
15
|
-
}
|
|
5
|
+
class ExchangeHandler extends BaseLocalizationHandler {
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
_raw = exchangeMap;
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
codes = ExchangeCodeItems;
|
|
16
10
|
/** @inheritDoc */
|
|
17
11
|
getSymbol(code) {
|
|
18
|
-
|
|
19
|
-
return (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.s;
|
|
12
|
+
return this.getRaw(code)?.s;
|
|
20
13
|
}
|
|
21
14
|
/** @inheritDoc */
|
|
22
15
|
getNumber(code) {
|
|
23
|
-
|
|
24
|
-
return (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.u;
|
|
16
|
+
return this.getRaw(code)?.u;
|
|
25
17
|
}
|
|
26
18
|
/** @inheritDoc */
|
|
27
19
|
getCountries(code) {
|
|
28
|
-
|
|
29
|
-
return (_b = (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.c) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
return this.getRaw(code)?.c ?? [];
|
|
30
21
|
}
|
|
31
22
|
/** @inheritDoc */
|
|
32
23
|
findByCountry(countryCode) {
|
|
@@ -42,14 +33,12 @@ class ExchangeHandler extends base_1.BaseLocalizationHandler {
|
|
|
42
33
|
return result;
|
|
43
34
|
}
|
|
44
35
|
get(code) {
|
|
45
|
-
var _a;
|
|
46
36
|
const item = this.getRaw(code);
|
|
47
37
|
if (!item) {
|
|
48
38
|
return { code, name: code, symbol: undefined, number: undefined, countries: [] };
|
|
49
39
|
}
|
|
50
|
-
return { code, name: item.n, symbol: item.s, number: item.u, countries:
|
|
40
|
+
return { code, name: item.n, symbol: item.s, number: item.u, countries: item.c ?? [] };
|
|
51
41
|
}
|
|
52
42
|
}
|
|
53
43
|
// noinspection JSUnusedGlobalSymbols
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=exchange.handler.js.map
|
|
44
|
+
export const exchangeHandler = new ExchangeHandler();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ExchangeCode } from "../literal/index.js";
|
|
2
|
+
import { ExchangeRaw } from "./index.types.js";
|
|
3
3
|
export declare const exchangeMap: Record<ExchangeCode, ExchangeRaw>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exchangeMap = void 0;
|
|
4
|
-
exports.exchangeMap = {
|
|
1
|
+
export const exchangeMap = {
|
|
5
2
|
AED: { n: "UAE Dirham", s: "د.إ", u: 784, c: ["AE"] },
|
|
6
3
|
AFN: { n: "Afghani", s: "Af", u: 971, c: ["AF"] },
|
|
7
4
|
ALL: { n: "Lek", s: "L", u: 8, c: ["AL"] },
|
|
@@ -169,4 +166,3 @@ exports.exchangeMap = {
|
|
|
169
166
|
c: ["GB", "AD", "AT", "BE", "CY", "EE", "FI", "FR", "DE", "GR", "IE", "IT", "LV", "LT", "LU", "MT", "MC", "ME", "NL", "PT", "SM", "SK", "SI", "ES", "VA"]
|
|
170
167
|
},
|
|
171
168
|
};
|
|
172
|
-
//# sourceMappingURL=exchange.map.js.map
|
package/dist/exchange/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './exchange.handler';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './exchange.handler.js';
|
package/dist/exchange/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./exchange-code"), exports);
|
|
18
|
-
__exportStar(require("./index.types"), exports);
|
|
19
|
-
__exportStar(require("./exchange.handler"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './exchange.handler.js';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base";
|
|
1
|
+
import { CountryCode, ExchangeCode } from "../literal/index.js";
|
|
2
|
+
import { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base/index.js";
|
|
4
3
|
/**
|
|
5
4
|
* Exchange raw format
|
|
6
5
|
* @interface
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export * from './base';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './country';
|
|
4
|
-
export * from './exchange';
|
|
5
|
-
export * from './language';
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
1
|
+
export * from './base/index.js';
|
|
2
|
+
export * from './config/index.js';
|
|
3
|
+
export * from './country/index.js';
|
|
4
|
+
export * from './exchange/index.js';
|
|
5
|
+
export * from './language/index.js';
|
|
6
|
+
export * from './literal/index.js';
|
|
7
|
+
export * from './locale/index.js';
|
|
8
|
+
export * from './parser/index.js';
|
|
9
|
+
export * from './timezone/index.js';
|
|
10
|
+
export * from './index.foretell.js';
|
|
11
|
+
export * from './index.loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const foretell_leyyoLocalization: (() => void)[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { foretell_leyyoCommon, literalPool } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "./internal.js";
|
|
3
|
+
import { foretell_leyyoBuilder } from "@leyyo/builder";
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
export const foretell_leyyoLocalization = [
|
|
6
|
+
// dependencies
|
|
7
|
+
...foretell_leyyoCommon,
|
|
8
|
+
...foretell_leyyoBuilder,
|
|
9
|
+
// literals
|
|
10
|
+
() => literalPool.lazy(FQN, 'BrowserType', import('./literal/browser-type.js').then(m => m.BrowserTypeItems), { i18n: true }),
|
|
11
|
+
() => literalPool.lazy(FQN, 'CountryCode', import('./literal/country-code.js').then(m => m.CountryCodeItems), { i18n: true }),
|
|
12
|
+
() => literalPool.lazy(FQN, 'CpuArchitecture', import('./literal/cpu-architecture.js').then(m => m.CpuArchitectureItems), { i18n: true }),
|
|
13
|
+
() => literalPool.lazy(FQN, 'DeviceType', import('./literal/device-type.js').then(m => m.DeviceTypeItems), { i18n: true }),
|
|
14
|
+
() => literalPool.lazy(FQN, 'EngineType', import('./literal/engine-type.js').then(m => m.EngineTypeItems), { i18n: true }),
|
|
15
|
+
() => literalPool.lazy(FQN, 'ExchangeCode', import('./literal/exchange-code.js').then(m => m.ExchangeCodeItems), { i18n: true }),
|
|
16
|
+
() => literalPool.lazy(FQN, 'LanguageCode', import('./literal/language-code.js').then(m => m.LanguageCodeItems), { i18n: true }),
|
|
17
|
+
() => literalPool.lazy(FQN, 'LocaleCode', import('./literal/locale-code.js').then(m => m.LocaleCodeItems), { i18n: true }),
|
|
18
|
+
() => literalPool.lazy(FQN, 'TimezoneCode', import('./literal/timezone-code.js').then(m => m.TimezoneCodeItems), { i18n: true }),
|
|
19
|
+
];
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./base"), exports);
|
|
18
|
-
__exportStar(require("./config"), exports);
|
|
19
|
-
__exportStar(require("./country"), exports);
|
|
20
|
-
__exportStar(require("./exchange"), exports);
|
|
21
|
-
__exportStar(require("./language"), exports);
|
|
22
|
-
__exportStar(require("./locale"), exports);
|
|
23
|
-
__exportStar(require("./timezone"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './base/index.js';
|
|
2
|
+
export * from './config/index.js';
|
|
3
|
+
export * from './country/index.js';
|
|
4
|
+
export * from './exchange/index.js';
|
|
5
|
+
export * from './language/index.js';
|
|
6
|
+
export * from './literal/index.js';
|
|
7
|
+
export * from './locale/index.js';
|
|
8
|
+
export * from './parser/index.js';
|
|
9
|
+
export * from './timezone/index.js';
|
|
10
|
+
export * from './index.foretell.js';
|
|
11
|
+
export * from './index.loader.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const loader_leyyoLocalization: import("@leyyo/common").LoaderLike;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineLoader, loader_leyyoCommon } from "@leyyo/common";
|
|
2
|
+
import { FQN } from "./internal.js";
|
|
3
|
+
import { loader_leyyoBuilder } from "@leyyo/builder";
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
export const loader_leyyoLocalization = defineLoader(FQN,
|
|
6
|
+
// dependencies
|
|
7
|
+
...loader_leyyoCommon, ...loader_leyyoBuilder,
|
|
8
|
+
// literals
|
|
9
|
+
() => import('./literal/browser-type.js').then(m => m.BrowserTypeItems), () => import('./literal/country-code.js').then(m => m.CountryCodeItems), () => import('./literal/cpu-architecture.js').then(m => m.CpuArchitectureItems), () => import('./literal/device-type.js').then(m => m.DeviceTypeItems), () => import('./literal/engine-type.js').then(m => m.EngineTypeItems), () => import('./literal/exchange-code.js').then(m => m.ExchangeCodeItems), () => import('./literal/language-code.js').then(m => m.LanguageCodeItems), () => import('./literal/locale-code.js').then(m => m.LocaleCodeItems), () => import('./literal/timezone-code.js').then(m => m.TimezoneCodeItems),
|
|
10
|
+
// classes
|
|
11
|
+
() => import('./base/base-localization.handler.js').then(m => m.BaseLocalizationHandler),
|
|
12
|
+
// instances
|
|
13
|
+
() => import('./config/localization.config.js').then(m => m.localizationConfig), () => import('./country/country.handler.js').then(m => m.countryHandler), () => import('./exchange/exchange.handler.js').then(m => m.exchangeHandler), () => import('./language/language.handler.js').then(m => m.languageHandler), () => import('./locale/locale.handler.js').then(m => m.localeHandler), () => import('./parser/localization.parser.js').then(m => m.localizationParser), () => import('./timezone/timezone.handler.js').then(m => m.timezoneHandler));
|
package/dist/internal.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const FQN
|
|
1
|
+
export declare const NME: string, FQN: string, VER: string, CNF: import("@leyyo/common").LeyyoConfig;
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.FQN = void 0;
|
|
4
|
-
// noinspection JSUnusedGlobalSymbols
|
|
5
|
-
exports.FQN = 'leyyo.localization_common';
|
|
6
|
-
//# sourceMappingURL=internal.js.map
|
|
1
|
+
import { sysAll } from '@leyyo/common';
|
|
2
|
+
export const { pck: { name: NME, fqn: FQN, version: VER }, config: CNF } = sysAll(import.meta.url);
|
package/dist/language/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './language.handler';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './language.handler.js';
|
package/dist/language/index.js
CHANGED
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./language-code"), exports);
|
|
18
|
-
__exportStar(require("./index.types"), exports);
|
|
19
|
-
__exportStar(require("./language.handler"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './language.handler.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { LanguageCode } from "../literal/index.js";
|
|
2
|
+
import { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Language raw format
|
|
5
5
|
* @interface
|