@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
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LanguageHandlerLike, LanguageRaw, LanguageView } from "./index.types";
|
|
3
|
-
import { BaseLocalizationHandler } from "../base";
|
|
4
|
-
/** @inheritDoc */
|
|
5
|
-
export declare class LanguageHandler extends BaseLocalizationHandler<LanguageCode, LanguageView, LanguageRaw> implements LanguageHandlerLike {
|
|
6
|
-
/** @inheritDoc */
|
|
7
|
-
protected _raw: Record<"id" | "cy" | "br" | "hr" | "li" | "th" | "tr" | "tt" | "mi" | "mn" | "ms" | "so" | "af" | "sq" | "an" | "ar" | "hy" | "as" | "az" | "eu" | "be" | "bn" | "bs" | "bg" | "my" | "ca" | "ch" | "ce" | "zh" | "cv" | "co" | "cr" | "cs" | "da" | "nl" | "en" | "eo" | "et" | "fo" | "fj" | "fi" | "fr" | "fy" | "gd" | "gl" | "ka" | "de" | "el" | "gu" | "ht" | "he" | "hi" | "hu" | "is" | "iu" | "ga" | "it" | "ja" | "kn" | "ks" | "kk" | "km" | "ky" | "ko" | "la" | "lv" | "lt" | "lb" | "mk" | "ml" | "mt" | "mr" | "nv" | "ng" | "ne" | "no" | "nb" | "nn" | "oc" | "or" | "om" | "fa" | "pl" | "pt" | "pa" | "qu" | "rm" | "ro" | "ru" | "sg" | "sa" | "sc" | "sd" | "si" | "sr" | "sk" | "sl" | "es" | "sw" | "sv" | "ta" | "te" | "ts" | "tn" | "tk" | "uk" | "ur" | "ve" | "vi" | "vo" | "wa" | "xh" | "zu" | "aa" | "ab" | "ae" | "ak" | "am" | "av" | "ay" | "ba" | "bh" | "bi" | "bm" | "bo" | "cu" | "dv" | "dz" | "ee" | "ff" | "gn" | "gv" | "ha" | "ho" | "hz" | "ia" | "ie" | "ig" | "ii" | "ik" | "io" | "jv" | "kg" | "ki" | "kj" | "kl" | "kr" | "ku" | "kv" | "kw" | "lg" | "ln" | "lo" | "lu" | "mg" | "mh" | "na" | "nd" | "nr" | "ny" | "oj" | "os" | "pi" | "ps" | "rn" | "rw" | "se" | "sm" | "sn" | "ss" | "st" | "su" | "tg" | "ti" | "tl" | "to" | "tw" | "ty" | "ug" | "uz" | "wo" | "yi" | "yo" | "za", import("../base").BaseLocalizationHandlerRaw>;
|
|
8
|
-
/** @inheritDoc */
|
|
9
|
-
readonly codes: readonly ("id" | "cy" | "br" | "hr" | "li" | "th" | "tr" | "tt" | "mi" | "mn" | "ms" | "so" | "af" | "sq" | "an" | "ar" | "hy" | "as" | "az" | "eu" | "be" | "bn" | "bs" | "bg" | "my" | "ca" | "ch" | "ce" | "zh" | "cv" | "co" | "cr" | "cs" | "da" | "nl" | "en" | "eo" | "et" | "fo" | "fj" | "fi" | "fr" | "fy" | "gd" | "gl" | "ka" | "de" | "el" | "gu" | "ht" | "he" | "hi" | "hu" | "is" | "iu" | "ga" | "it" | "ja" | "kn" | "ks" | "kk" | "km" | "ky" | "ko" | "la" | "lv" | "lt" | "lb" | "mk" | "ml" | "mt" | "mr" | "nv" | "ng" | "ne" | "no" | "nb" | "nn" | "oc" | "or" | "om" | "fa" | "pl" | "pt" | "pa" | "qu" | "rm" | "ro" | "ru" | "sg" | "sa" | "sc" | "sd" | "si" | "sr" | "sk" | "sl" | "es" | "sw" | "sv" | "ta" | "te" | "ts" | "tn" | "tk" | "uk" | "ur" | "ve" | "vi" | "vo" | "wa" | "xh" | "zu" | "aa" | "ab" | "ae" | "ak" | "am" | "av" | "ay" | "ba" | "bh" | "bi" | "bm" | "bo" | "cu" | "dv" | "dz" | "ee" | "ff" | "gn" | "gv" | "ha" | "ho" | "hz" | "ia" | "ie" | "ig" | "ii" | "ik" | "io" | "jv" | "kg" | "ki" | "kj" | "kl" | "kr" | "ku" | "kv" | "kw" | "lg" | "ln" | "lo" | "lu" | "mg" | "mh" | "na" | "nd" | "nr" | "ny" | "oj" | "os" | "pi" | "ps" | "rn" | "rw" | "se" | "sm" | "sn" | "ss" | "st" | "su" | "tg" | "ti" | "tl" | "to" | "tw" | "ty" | "ug" | "uz" | "wo" | "yi" | "yo" | "za")[];
|
|
10
|
-
get(code: LanguageCode): LanguageView;
|
|
11
|
-
}
|
|
1
|
+
import { LanguageHandlerLike } from "./index.types.js";
|
|
12
2
|
export declare const languageHandler: LanguageHandlerLike;
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const language_code_1 = require("./language-code");
|
|
5
|
-
const language_map_1 = require("./language.map");
|
|
6
|
-
const base_1 = require("../base");
|
|
1
|
+
import { LanguageCodeItems } from "../literal/index.js";
|
|
2
|
+
import { languageMap } from "./language.map.js";
|
|
3
|
+
import { BaseLocalizationHandler } from "../base/index.js";
|
|
7
4
|
/** @inheritDoc */
|
|
8
|
-
class LanguageHandler extends
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** @inheritDoc */
|
|
14
|
-
this.codes = language_code_1.LanguageCodeItems;
|
|
15
|
-
}
|
|
5
|
+
class LanguageHandler extends BaseLocalizationHandler {
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
_raw = languageMap;
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
codes = LanguageCodeItems;
|
|
16
10
|
get(code) {
|
|
17
11
|
const item = this.getRaw(code);
|
|
18
12
|
if (!item) {
|
|
@@ -21,12 +15,10 @@ class LanguageHandler extends base_1.BaseLocalizationHandler {
|
|
|
21
15
|
return { code, name: item.n };
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
exports.LanguageHandler = LanguageHandler;
|
|
25
18
|
// noinspection JSUnusedGlobalSymbols
|
|
26
|
-
|
|
19
|
+
export const languageHandler = new LanguageHandler();
|
|
27
20
|
/*
|
|
28
21
|
* @todo
|
|
29
22
|
* - https://www.loc.gov/standards/iso639-2/php/code_list.php
|
|
30
23
|
* - https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes (set2, set3)
|
|
31
24
|
* */
|
|
32
|
-
//# sourceMappingURL=language.handler.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { LanguageCode } from "../literal/index.js";
|
|
2
|
+
import { LanguageRaw } from "./index.types.js";
|
|
3
3
|
export declare const languageMap: Record<LanguageCode, LanguageRaw>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.languageMap = void 0;
|
|
4
|
-
exports.languageMap = {
|
|
1
|
+
export const languageMap = {
|
|
5
2
|
aa: { n: 'Afar' },
|
|
6
3
|
ab: { n: 'Abkhaz' },
|
|
7
4
|
ae: { n: 'Avestan' },
|
|
@@ -187,4 +184,3 @@ exports.languageMap = {
|
|
|
187
184
|
zh: { n: 'Chinese' },
|
|
188
185
|
zu: { n: 'Zulu' },
|
|
189
186
|
};
|
|
190
|
-
//# sourceMappingURL=language.map.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const literals: readonly ["crawler", "cli", "email", "fetcher", "inapp", "mediaplayer", "library"];
|
|
2
|
+
/**
|
|
3
|
+
* Browser Type
|
|
4
|
+
* */
|
|
5
|
+
export type BrowserType = typeof literals[number];
|
|
6
|
+
export declare const BrowserTypeItems: ReadonlyArray<BrowserType>;
|
|
7
|
+
export {};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CountryCodeItems = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Country code items
|
|
6
3
|
* */
|
|
@@ -15,5 +12,4 @@ const literals = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', 'A
|
|
|
15
12
|
'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM',
|
|
16
13
|
'SN', 'SO', 'SS', 'SR', 'ST', 'SX', 'SV', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ',
|
|
17
14
|
'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW'];
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=country-code.js.map
|
|
15
|
+
export const CountryCodeItems = literals;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const literals: readonly ["ia32", "ia64", "amd64", "arm", "arm64", "armhf", "avr", "avr32", "irix", "irix64", "mips", "mips64", "68k", "pa-risc", "ppc", "sparc", "sparc64"];
|
|
2
|
+
/**
|
|
3
|
+
* Cpu Architecture
|
|
4
|
+
* */
|
|
5
|
+
export type CpuArchitecture = typeof literals[number];
|
|
6
|
+
export declare const CpuArchitectureItems: ReadonlyArray<CpuArchitecture>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const literals = [
|
|
2
|
+
'ia32',
|
|
3
|
+
'ia64',
|
|
4
|
+
'amd64',
|
|
5
|
+
'arm',
|
|
6
|
+
'arm64',
|
|
7
|
+
'armhf',
|
|
8
|
+
'avr',
|
|
9
|
+
'avr32',
|
|
10
|
+
'irix',
|
|
11
|
+
'irix64',
|
|
12
|
+
'mips',
|
|
13
|
+
'mips64',
|
|
14
|
+
'68k',
|
|
15
|
+
'pa-risc',
|
|
16
|
+
'ppc',
|
|
17
|
+
'sparc',
|
|
18
|
+
'sparc64',
|
|
19
|
+
];
|
|
20
|
+
export const CpuArchitectureItems = literals;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const literals: readonly ["mobile", "tablet", "console", "smarttv", "wearable", "xr", "embedded", "testing"];
|
|
2
|
+
/**
|
|
3
|
+
* Device Type
|
|
4
|
+
* */
|
|
5
|
+
export type DeviceType = typeof literals[number];
|
|
6
|
+
export declare const DeviceTypeItems: ReadonlyArray<DeviceType>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const literals: readonly ["Amaya", "ArkWeb", "Blink", "EdgeHTML", "Flow", "Gecko", "Goanna", "iCab", "KHTML", "LibWeb", "Links", "Lynx", "NetFront", "NetSurf", "Presto", "Servo", "Tasman", "Trident", "w3m", "WebKit"];
|
|
2
|
+
/**
|
|
3
|
+
* Engine Type
|
|
4
|
+
* */
|
|
5
|
+
export type EngineType = typeof literals[number];
|
|
6
|
+
export declare const EngineTypeItems: ReadonlyArray<EngineType>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const literals = [
|
|
2
|
+
'Amaya',
|
|
3
|
+
'ArkWeb',
|
|
4
|
+
'Blink',
|
|
5
|
+
'EdgeHTML',
|
|
6
|
+
'Flow',
|
|
7
|
+
'Gecko',
|
|
8
|
+
'Goanna',
|
|
9
|
+
'iCab',
|
|
10
|
+
'KHTML',
|
|
11
|
+
'LibWeb',
|
|
12
|
+
'Links',
|
|
13
|
+
'Lynx',
|
|
14
|
+
'NetFront',
|
|
15
|
+
'NetSurf',
|
|
16
|
+
'Presto',
|
|
17
|
+
'Servo',
|
|
18
|
+
'Tasman',
|
|
19
|
+
'Trident',
|
|
20
|
+
'w3m',
|
|
21
|
+
'WebKit',
|
|
22
|
+
];
|
|
23
|
+
export const EngineTypeItems = literals;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExchangeCodeItems = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Country code items
|
|
6
3
|
* */
|
|
@@ -19,5 +16,4 @@ const literals = [
|
|
|
19
16
|
'YER', 'ZMW', 'ZWL', 'BND', 'CHF', 'ILS', 'INR', 'RSD', 'SGD', 'GBP', 'SHP', 'XPF',
|
|
20
17
|
'ZAR', 'NZD', 'AUD', 'XCD', 'USD', 'XAF', 'EUR'
|
|
21
18
|
];
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=exchange-code.js.map
|
|
19
|
+
export const ExchangeCodeItems = literals;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './browser-type.js';
|
|
2
|
+
export * from './country-code.js';
|
|
3
|
+
export * from './cpu-architecture.js';
|
|
4
|
+
export * from './device-type.js';
|
|
5
|
+
export * from './engine-type.js';
|
|
6
|
+
export * from './exchange-code.js';
|
|
7
|
+
export * from './language-code.js';
|
|
8
|
+
export * from './locale-code.js';
|
|
9
|
+
export * from './timezone-code.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './browser-type.js';
|
|
2
|
+
export * from './country-code.js';
|
|
3
|
+
export * from './cpu-architecture.js';
|
|
4
|
+
export * from './device-type.js';
|
|
5
|
+
export * from './engine-type.js';
|
|
6
|
+
export * from './exchange-code.js';
|
|
7
|
+
export * from './language-code.js';
|
|
8
|
+
export * from './locale-code.js';
|
|
9
|
+
export * from './timezone-code.js';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LanguageCodeItems = void 0;
|
|
4
1
|
const literals = [
|
|
5
2
|
'aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az',
|
|
6
3
|
'ba', 'be', 'bg', 'bh', 'bi', 'bm', 'bn', 'bo', 'br', 'bs',
|
|
@@ -29,5 +26,4 @@ const literals = [
|
|
|
29
26
|
'yi', 'yo',
|
|
30
27
|
'za', 'zh', 'zu'
|
|
31
28
|
];
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=language-code.js.map
|
|
29
|
+
export const LanguageCodeItems = literals;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocaleCodeItems = void 0;
|
|
4
1
|
const literals = [
|
|
5
2
|
'af', 'sq', 'an', 'ar', 'ar-dz', 'ar-bh', 'ar-eg', 'ar-iq', 'ar-jo', 'ar-kw',
|
|
6
3
|
'ar-lb', 'ar-ly', 'ar-ma', 'ar-om', 'ar-qa', 'ar-sa', 'ar-sy', 'ar-tn',
|
|
@@ -21,5 +18,4 @@ const literals = [
|
|
|
21
18
|
'sw', 'sv', 'sv-fi', 'sv-sv', 'ta', 'tt', 'te', 'th', 'tig', 'ts', 'tn', 'tr',
|
|
22
19
|
'tk', 'uk', 'hsb', 'ur', 've', 'vi', 'vo', 'wa', 'cy', 'xh', 'ji', 'zu',
|
|
23
20
|
];
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=locale-code.js.map
|
|
21
|
+
export const LocaleCodeItems = literals;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimezoneCodeItems = void 0;
|
|
4
1
|
const literals = [
|
|
5
2
|
'EST', 'CST6CDT', 'MST7MDT', 'PST8PDT', 'EST5EDT', 'MST', 'Asia/Urumqi', 'WET', 'CET', 'MET', 'EET',
|
|
6
3
|
'Africa/Bamako', 'Africa/Banjul', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Freetown', 'Africa/Lome',
|
|
@@ -105,5 +102,4 @@ const literals = [
|
|
|
105
102
|
'Asia/Dili', 'Asia/Jayapura', 'Asia/Khandyga', 'Asia/Pyongyang', 'Asia/Seoul', 'Asia/Tokyo', 'Asia/Yakutsk',
|
|
106
103
|
'Pacific/Palau', 'Australia/Adelaide', 'Australia/Broken_Hill', 'Australia/Darwin',
|
|
107
104
|
];
|
|
108
|
-
|
|
109
|
-
//# sourceMappingURL=timezone-code.js.map
|
|
105
|
+
export const TimezoneCodeItems = literals;
|
package/dist/locale/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './locale.handler';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './locale.handler.js';
|
package/dist/locale/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("./locale-code"), exports);
|
|
18
|
-
__exportStar(require("./index.types"), exports);
|
|
19
|
-
__exportStar(require("./locale.handler"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './locale.handler.js';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { LocaleCode } from "./locale-code";
|
|
4
|
-
import type { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base";
|
|
1
|
+
import { CountryCode, LanguageCode, LocaleCode } from "../literal/index.js";
|
|
2
|
+
import { BaseLocalizationHandlerLike, BaseLocalizationHandlerRaw, BaseLocalizationHandlerView } from "../base/index.js";
|
|
5
3
|
/**
|
|
6
4
|
* Locale raw format
|
|
7
5
|
* @interface
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LanguageCode } from "../language";
|
|
3
|
-
import type { CountryCode } from "../country";
|
|
4
|
-
import type { LocaleHandlerLike, LocaleRaw, LocaleView } from "./index.types";
|
|
5
|
-
import { BaseLocalizationHandler } from "../base";
|
|
6
|
-
/** @inheritDoc */
|
|
7
|
-
export declare class LocaleHandler extends BaseLocalizationHandler<LocaleCode, LocaleView, LocaleRaw> implements LocaleHandlerLike {
|
|
8
|
-
/** @inheritDoc */
|
|
9
|
-
protected _raw: Record<"id" | "cy" | "br" | "hr" | "th" | "tr" | "tt" | "mi" | "mo" | "ms" | "so" | "af" | "sq" | "an" | "ar" | "ar-dz" | "ar-bh" | "ar-eg" | "ar-iq" | "ar-jo" | "ar-kw" | "ar-lb" | "ar-ly" | "ar-ma" | "ar-om" | "ar-qa" | "ar-sa" | "ar-sy" | "ar-tn" | "ar-ae" | "ar-ye" | "hy" | "as" | "ast" | "az" | "eu" | "be" | "bn" | "bs" | "bg" | "my" | "ca" | "ch" | "ce" | "zh" | "zh-hk" | "zh-cn" | "zh-sg" | "zh-tw" | "cv" | "co" | "cr" | "cs" | "da" | "nl" | "nl-be" | "en" | "en-au" | "en-bz" | "en-ca" | "en-ie" | "en-jm" | "en-nz" | "en-ph" | "en-za" | "en-tt" | "en-gb" | "en-us" | "en-zw" | "eo" | "et" | "fo" | "fj" | "fi" | "fr" | "fr-be" | "fr-ca" | "fr-fr" | "fr-lu" | "fr-mc" | "fr-ch" | "fy" | "fur" | "gd" | "gd-ie" | "gl" | "ka" | "de" | "de-at" | "de-de" | "de-li" | "de-lu" | "de-ch" | "el" | "gu" | "ht" | "he" | "hi" | "hu" | "is" | "iu" | "ga" | "it" | "it-ch" | "ja" | "kn" | "ks" | "kk" | "km" | "ky" | "tlh" | "ko" | "ko-kp" | "ko-kr" | "la" | "lv" | "lt" | "lb" | "mk" | "ml" | "mt" | "mr" | "nv" | "ng" | "ne" | "no" | "nb" | "nn" | "oc" | "or" | "om" | "fa" | "fa-ir" | "pl" | "pt" | "pt-br" | "pa" | "pa-in" | "pa-pk" | "qu" | "rm" | "ro" | "ro-mo" | "ru" | "ru-mo" | "sz" | "sg" | "sa" | "sc" | "sd" | "si" | "sr" | "sk" | "sl" | "sb" | "es" | "es-ar" | "es-bo" | "es-cl" | "es-co" | "es-cr" | "es-do" | "es-ec" | "es-sv" | "es-gt" | "es-hn" | "es-mx" | "es-ni" | "es-pa" | "es-py" | "es-pe" | "es-pr" | "es-es" | "es-uy" | "es-ve" | "sx" | "sw" | "sv" | "sv-fi" | "sv-sv" | "ta" | "te" | "tig" | "ts" | "tn" | "tk" | "uk" | "hsb" | "ur" | "ve" | "vi" | "vo" | "wa" | "xh" | "ji" | "zu", LocaleRaw>;
|
|
10
|
-
/** @inheritDoc */
|
|
11
|
-
readonly codes: readonly ("id" | "cy" | "br" | "hr" | "th" | "tr" | "tt" | "mi" | "mo" | "ms" | "so" | "af" | "sq" | "an" | "ar" | "ar-dz" | "ar-bh" | "ar-eg" | "ar-iq" | "ar-jo" | "ar-kw" | "ar-lb" | "ar-ly" | "ar-ma" | "ar-om" | "ar-qa" | "ar-sa" | "ar-sy" | "ar-tn" | "ar-ae" | "ar-ye" | "hy" | "as" | "ast" | "az" | "eu" | "be" | "bn" | "bs" | "bg" | "my" | "ca" | "ch" | "ce" | "zh" | "zh-hk" | "zh-cn" | "zh-sg" | "zh-tw" | "cv" | "co" | "cr" | "cs" | "da" | "nl" | "nl-be" | "en" | "en-au" | "en-bz" | "en-ca" | "en-ie" | "en-jm" | "en-nz" | "en-ph" | "en-za" | "en-tt" | "en-gb" | "en-us" | "en-zw" | "eo" | "et" | "fo" | "fj" | "fi" | "fr" | "fr-be" | "fr-ca" | "fr-fr" | "fr-lu" | "fr-mc" | "fr-ch" | "fy" | "fur" | "gd" | "gd-ie" | "gl" | "ka" | "de" | "de-at" | "de-de" | "de-li" | "de-lu" | "de-ch" | "el" | "gu" | "ht" | "he" | "hi" | "hu" | "is" | "iu" | "ga" | "it" | "it-ch" | "ja" | "kn" | "ks" | "kk" | "km" | "ky" | "tlh" | "ko" | "ko-kp" | "ko-kr" | "la" | "lv" | "lt" | "lb" | "mk" | "ml" | "mt" | "mr" | "nv" | "ng" | "ne" | "no" | "nb" | "nn" | "oc" | "or" | "om" | "fa" | "fa-ir" | "pl" | "pt" | "pt-br" | "pa" | "pa-in" | "pa-pk" | "qu" | "rm" | "ro" | "ro-mo" | "ru" | "ru-mo" | "sz" | "sg" | "sa" | "sc" | "sd" | "si" | "sr" | "sk" | "sl" | "sb" | "es" | "es-ar" | "es-bo" | "es-cl" | "es-co" | "es-cr" | "es-do" | "es-ec" | "es-sv" | "es-gt" | "es-hn" | "es-mx" | "es-ni" | "es-pa" | "es-py" | "es-pe" | "es-pr" | "es-es" | "es-uy" | "es-ve" | "sx" | "sw" | "sv" | "sv-fi" | "sv-sv" | "ta" | "te" | "tig" | "ts" | "tn" | "tk" | "uk" | "hsb" | "ur" | "ve" | "vi" | "vo" | "wa" | "xh" | "ji" | "zu")[];
|
|
12
|
-
/** @inheritDoc */
|
|
13
|
-
getLanguage(code: LocaleCode): LanguageCode;
|
|
14
|
-
/** @inheritDoc */
|
|
15
|
-
getCountries(code: LocaleCode): Array<CountryCode>;
|
|
16
|
-
get(code: LocaleCode): LocaleView;
|
|
17
|
-
}
|
|
1
|
+
import { LocaleHandlerLike } from "./index.types.js";
|
|
18
2
|
export declare const localeHandler: LocaleHandlerLike;
|
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const locale_code_1 = require("./locale-code");
|
|
5
|
-
const locale_map_1 = require("./locale.map");
|
|
6
|
-
const base_1 = require("../base");
|
|
1
|
+
import { LocaleCodeItems } from "../literal/index.js";
|
|
2
|
+
import { localeMap } from "./locale.map.js";
|
|
3
|
+
import { BaseLocalizationHandler } from "../base/index.js";
|
|
7
4
|
/** @inheritDoc */
|
|
8
|
-
class LocaleHandler extends
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** @inheritDoc */
|
|
14
|
-
this.codes = locale_code_1.LocaleCodeItems;
|
|
15
|
-
}
|
|
5
|
+
class LocaleHandler extends BaseLocalizationHandler {
|
|
6
|
+
/** @inheritDoc */
|
|
7
|
+
_raw = localeMap;
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
codes = LocaleCodeItems;
|
|
16
10
|
/** @inheritDoc */
|
|
17
11
|
getLanguage(code) {
|
|
18
|
-
|
|
19
|
-
return (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.l;
|
|
12
|
+
return this.getRaw(code)?.l;
|
|
20
13
|
}
|
|
21
14
|
/** @inheritDoc */
|
|
22
15
|
getCountries(code) {
|
|
23
|
-
|
|
24
|
-
return (_b = (_a = this.getRaw(code)) === null || _a === void 0 ? void 0 : _a.c) !== null && _b !== void 0 ? _b : [];
|
|
16
|
+
return this.getRaw(code)?.c ?? [];
|
|
25
17
|
}
|
|
26
18
|
get(code) {
|
|
27
|
-
var _a;
|
|
28
19
|
const item = this.getRaw(code);
|
|
29
20
|
if (!item) {
|
|
30
21
|
return { code, name: code, language: undefined, countries: [] };
|
|
31
22
|
}
|
|
32
|
-
return { code, name: item.n, language: item.l, countries:
|
|
23
|
+
return { code, name: item.n, language: item.l, countries: item.c ?? [] };
|
|
33
24
|
}
|
|
34
25
|
}
|
|
35
|
-
exports.LocaleHandler = LocaleHandler;
|
|
36
26
|
// noinspection JSUnusedGlobalSymbols
|
|
37
|
-
|
|
27
|
+
export const localeHandler = new LocaleHandler();
|
|
38
28
|
/*
|
|
39
29
|
* @todo
|
|
40
30
|
* - https://learn.microsoft.com/en-us/graph/search-concept-acceptlanguage-header
|
|
41
31
|
* - https://www.w3schools.com/tags/ref_language_codes.asp
|
|
42
32
|
* - https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
|
|
43
33
|
* */
|
|
44
|
-
//# sourceMappingURL=locale.handler.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { LocaleCode } from "../literal/index.js";
|
|
2
|
+
import { LocaleRaw } from "./index.types.js";
|
|
3
3
|
export declare const localeMap: Record<LocaleCode, LocaleRaw>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.localeMap = void 0;
|
|
4
|
-
exports.localeMap = {
|
|
1
|
+
export const localeMap = {
|
|
5
2
|
af: { n: "Afrikaans", l: 'af' },
|
|
6
3
|
sq: { n: "Albanian", l: 'sq' },
|
|
7
4
|
an: { n: "Aragonese", l: 'an' },
|
|
@@ -199,4 +196,3 @@ exports.localeMap = {
|
|
|
199
196
|
tig: { n: "Tigre" },
|
|
200
197
|
hsb: { n: "Upper Sorbian" },
|
|
201
198
|
};
|
|
202
|
-
//# sourceMappingURL=locale.map.js.map
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './index.types';
|
|
2
|
-
export * from './localization.parser';
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './localization.parser.js';
|
package/dist/parser/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.parser"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './index.types.js';
|
|
2
|
+
export * from './localization.parser.js';
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import type { TimezoneCode } from "../timezone";
|
|
4
|
-
import type { CountryCode } from "../country";
|
|
5
|
-
import type { Request } from "express";
|
|
6
|
-
import type { ExchangeCode } from "../exchange";
|
|
1
|
+
import { BrowserType, CountryCode, CpuArchitecture, DeviceType, EngineType, ExchangeCode, LanguageCode, LocaleCode, TimezoneCode } from "../literal/index.js";
|
|
2
|
+
import { Request } from "express";
|
|
7
3
|
export interface LocalizationContext {
|
|
8
4
|
error?: Error;
|
|
9
|
-
token?:
|
|
5
|
+
token?: LocalizationContextMap;
|
|
10
6
|
correlation?: LocalizationContextKey;
|
|
11
7
|
language?: LocalizationContextLanguage;
|
|
12
8
|
application?: LocalizationContextApp;
|
|
@@ -24,6 +20,7 @@ export interface LocalizationContextKey {
|
|
|
24
20
|
key?: string;
|
|
25
21
|
header?: string;
|
|
26
22
|
}
|
|
23
|
+
export type LocalizationContextMap = Record<string, string>;
|
|
27
24
|
export interface LocalizationContextApp extends LocalizationContextKey {
|
|
28
25
|
name?: string;
|
|
29
26
|
version?: string;
|
|
@@ -157,23 +154,6 @@ export interface LocalizationContextOs {
|
|
|
157
154
|
* */
|
|
158
155
|
version?: string;
|
|
159
156
|
}
|
|
160
|
-
/**
|
|
161
|
-
* Browser Engine Types
|
|
162
|
-
* */
|
|
163
|
-
export type EngineType = 'Amaya' | 'ArkWeb' | 'Blink' | 'EdgeHTML' | 'Flow' | 'Gecko' | 'Goanna' | 'iCab' | 'KHTML' | 'LibWeb' | 'Links' | 'Lynx' | 'NetFront' | 'NetSurf' | 'Presto' | 'Servo' | 'Tasman' | 'Trident' | 'w3m' | 'WebKit';
|
|
164
|
-
/**
|
|
165
|
-
* Device Types
|
|
166
|
-
* */
|
|
167
|
-
export type DeviceType = 'mobile' | 'tablet' | 'console' | 'smarttv' | 'wearable' | 'xr' | 'embedded' | 'testing';
|
|
168
|
-
/**
|
|
169
|
-
* CPU Architectures
|
|
170
|
-
* */
|
|
171
|
-
export type CpuArchitecture = 'ia32' | 'ia64' | 'amd64' | 'arm' | 'arm64' | 'armhf' | 'avr' | 'avr32' | 'irix' | 'irix64' | 'mips' | 'mips64' | '68k' | 'pa-risc' | 'ppc' | 'sparc' | 'sparc64';
|
|
172
|
-
/**
|
|
173
|
-
* Browser types
|
|
174
|
-
* */
|
|
175
|
-
type BrowserType = 'crawler' | 'cli' | 'email' | 'fetcher' | 'inapp' | 'mediaplayer' | 'library';
|
|
176
157
|
export interface LocalizationParserLike {
|
|
177
158
|
parse(req: Request): LocalizationContext;
|
|
178
159
|
}
|
|
179
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalizationParserLike } from "./index.types.js";
|
|
2
2
|
export declare const localizationParser: LocalizationParserLike;
|