@fgv/ts-bcp47 5.0.0-21 → 5.0.0-23
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/package.json +8 -8
- package/src/data/bcp/overrides.json +0 -20
- package/src/data/iana/language-subtags.json +0 -57439
- package/src/data/iana/language-tag-extensions.json +0 -38
- package/src/data/unsd/m49.json +0 -3723
- package/src/index.ts +0 -29
- package/src/packlets/bcp47/bcp47Subtags/converters.ts +0 -33
- package/src/packlets/bcp47/bcp47Subtags/index.ts +0 -27
- package/src/packlets/bcp47/bcp47Subtags/model.ts +0 -46
- package/src/packlets/bcp47/bcp47Subtags/validate.ts +0 -55
- package/src/packlets/bcp47/common.ts +0 -85
- package/src/packlets/bcp47/helpers.ts +0 -117
- package/src/packlets/bcp47/index.ts +0 -38
- package/src/packlets/bcp47/languageRegistryData.ts +0 -304
- package/src/packlets/bcp47/languageTag.ts +0 -467
- package/src/packlets/bcp47/languageTagParser.ts +0 -307
- package/src/packlets/bcp47/match/chooser.ts +0 -164
- package/src/packlets/bcp47/match/common.ts +0 -57
- package/src/packlets/bcp47/match/index.ts +0 -26
- package/src/packlets/bcp47/match/similarity.ts +0 -243
- package/src/packlets/bcp47/normalization/baseNormalizer.ts +0 -146
- package/src/packlets/bcp47/normalization/canonicalNormalizer.ts +0 -102
- package/src/packlets/bcp47/normalization/common.ts +0 -84
- package/src/packlets/bcp47/normalization/index.ts +0 -27
- package/src/packlets/bcp47/normalization/normalizeTag.ts +0 -116
- package/src/packlets/bcp47/normalization/preferredTagNormalizer.ts +0 -213
- package/src/packlets/bcp47/overrides/converters.ts +0 -58
- package/src/packlets/bcp47/overrides/defaultRegistries.ts +0 -40
- package/src/packlets/bcp47/overrides/index.ts +0 -25
- package/src/packlets/bcp47/overrides/model.ts +0 -33
- package/src/packlets/bcp47/overrides/overridesRegistry.ts +0 -104
- package/src/packlets/bcp47/validation/baseValidator.ts +0 -132
- package/src/packlets/bcp47/validation/common.ts +0 -86
- package/src/packlets/bcp47/validation/index.ts +0 -29
- package/src/packlets/bcp47/validation/isCanonical.ts +0 -103
- package/src/packlets/bcp47/validation/isInPreferredForm.ts +0 -53
- package/src/packlets/bcp47/validation/isStrictlyValid.ts +0 -117
- package/src/packlets/bcp47/validation/isValid.ts +0 -122
- package/src/packlets/bcp47/validation/isWellFormed.ts +0 -102
- package/src/packlets/bcp47/validation/validateTag.ts +0 -175
- package/src/packlets/iana/common/converters.ts +0 -67
- package/src/packlets/iana/common/model.ts +0 -56
- package/src/packlets/iana/common/registeredItems.ts +0 -145
- package/src/packlets/iana/common/utils.ts +0 -32
- package/src/packlets/iana/common/validate.ts +0 -64
- package/src/packlets/iana/converters.ts +0 -26
- package/src/packlets/iana/defaultRegistries.ts +0 -40
- package/src/packlets/iana/index.ts +0 -33
- package/src/packlets/iana/jar/converters.ts +0 -26
- package/src/packlets/iana/jar/index.ts +0 -27
- package/src/packlets/iana/jar/jarConverters.ts +0 -70
- package/src/packlets/iana/jar/jarModel.ts +0 -34
- package/src/packlets/iana/jar/language-subtags/converters.ts +0 -26
- package/src/packlets/iana/jar/language-subtags/index.ts +0 -27
- package/src/packlets/iana/jar/language-subtags/model.ts +0 -26
- package/src/packlets/iana/jar/language-subtags/registry/converters.ts +0 -40
- package/src/packlets/iana/jar/language-subtags/registry/index.ts +0 -26
- package/src/packlets/iana/jar/language-subtags/registry/model.ts +0 -171
- package/src/packlets/iana/jar/language-subtags/tags/converters.ts +0 -120
- package/src/packlets/iana/jar/language-subtags/tags/index.ts +0 -28
- package/src/packlets/iana/jar/language-subtags/tags/model.ts +0 -71
- package/src/packlets/iana/jar/language-subtags/tags/tagValidation.ts +0 -67
- package/src/packlets/iana/jar/language-subtags/tags/validate.ts +0 -106
- package/src/packlets/iana/jar/model.ts +0 -26
- package/src/packlets/iana/language-subtags/common.ts +0 -46
- package/src/packlets/iana/language-subtags/converters.ts +0 -226
- package/src/packlets/iana/language-subtags/index.ts +0 -30
- package/src/packlets/iana/language-subtags/jarConverters.ts +0 -269
- package/src/packlets/iana/language-subtags/model.ts +0 -213
- package/src/packlets/iana/language-subtags/scope.ts +0 -222
- package/src/packlets/iana/language-subtags/subtagRegistry.ts +0 -136
- package/src/packlets/iana/language-subtags/validate.ts +0 -23
- package/src/packlets/iana/language-tag-extensions/converters.ts +0 -71
- package/src/packlets/iana/language-tag-extensions/extensionsRegistry.ts +0 -92
- package/src/packlets/iana/language-tag-extensions/extensionsScope.ts +0 -60
- package/src/packlets/iana/language-tag-extensions/index.ts +0 -29
- package/src/packlets/iana/language-tag-extensions/jarConverters.ts +0 -91
- package/src/packlets/iana/language-tag-extensions/model.ts +0 -67
- package/src/packlets/iana/language-tag-extensions/validate.ts +0 -36
- package/src/packlets/iana/languageRegistries.ts +0 -57
- package/src/packlets/iana/model.ts +0 -26
- package/src/packlets/iana/validate.ts +0 -23
- package/src/packlets/unsd/areas.ts +0 -105
- package/src/packlets/unsd/common.ts +0 -79
- package/src/packlets/unsd/csv/converters.ts +0 -82
- package/src/packlets/unsd/csv/index.ts +0 -26
- package/src/packlets/unsd/csv/model.ts +0 -44
- package/src/packlets/unsd/defaultRegistries.ts +0 -40
- package/src/packlets/unsd/index.ts +0 -28
- package/src/packlets/unsd/regionCodes.ts +0 -144
- package/src/packlets/unsd/regions.ts +0 -95
- package/src/packlets/utils/index.ts +0 -24
- package/src/packlets/utils/jsonHelpers.ts +0 -25
- package/src/packlets/utils/public.ts +0 -28
- package/src/packlets/utils/validationHelpers.ts +0 -180
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import * as path from 'path';
|
|
24
|
-
import * as Converters from './converters';
|
|
25
|
-
import * as JarConverters from './jarConverters';
|
|
26
|
-
import * as Scope from './scope';
|
|
27
|
-
|
|
28
|
-
import { Result, captureResult } from '@fgv/ts-utils';
|
|
29
|
-
import { YearMonthDaySpec } from '../jar/language-subtags/registry/model';
|
|
30
|
-
import { RegisteredItem, RegistryFile } from './model';
|
|
31
|
-
// eslint-disable-next-line @rushstack/packlets/mechanics
|
|
32
|
-
import defaultSubtags from '../../../data/iana/language-subtags.json';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
export class LanguageSubtagRegistry {
|
|
38
|
-
public readonly fileDate: YearMonthDaySpec;
|
|
39
|
-
public readonly languages: Scope.LanguageSubtagScope = new Scope.LanguageSubtagScope();
|
|
40
|
-
public readonly extlangs: Scope.ExtLangSubtagScope = new Scope.ExtLangSubtagScope();
|
|
41
|
-
public readonly scripts: Scope.ScriptSubtagScope = new Scope.ScriptSubtagScope();
|
|
42
|
-
public readonly regions: Scope.RegionSubtagScope = new Scope.RegionSubtagScope();
|
|
43
|
-
public readonly variants: Scope.VariantSubtagScope = new Scope.VariantSubtagScope();
|
|
44
|
-
|
|
45
|
-
public readonly collections: Scope.LanguageSubtagScope = new Scope.LanguageSubtagScope();
|
|
46
|
-
public readonly macrolanguages: Scope.LanguageSubtagScope = new Scope.LanguageSubtagScope();
|
|
47
|
-
public readonly privateUse: Scope.LanguageSubtagScope = new Scope.LanguageSubtagScope();
|
|
48
|
-
public readonly special: Scope.LanguageSubtagScope = new Scope.LanguageSubtagScope();
|
|
49
|
-
|
|
50
|
-
public readonly grandfathered: Scope.GrandfatheredTagScope = new Scope.GrandfatheredTagScope();
|
|
51
|
-
public readonly redundant: Scope.RedundantTagScope = new Scope.RedundantTagScope();
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
protected readonly _all: RegisteredItem[];
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @param registry - The contents of the registry file
|
|
60
|
-
* from which the data is loaded.
|
|
61
|
-
* @internal
|
|
62
|
-
*/
|
|
63
|
-
protected constructor(registry: RegistryFile) {
|
|
64
|
-
this.fileDate = registry.fileDate;
|
|
65
|
-
this._all = registry.entries;
|
|
66
|
-
for (const entry of this._all) {
|
|
67
|
-
switch (entry.type) {
|
|
68
|
-
case 'language':
|
|
69
|
-
this.languages.add(entry);
|
|
70
|
-
if (entry.scope === 'macrolanguage') {
|
|
71
|
-
this.macrolanguages.add(entry);
|
|
72
|
-
} else if (entry.scope === 'collection') {
|
|
73
|
-
this.collections.add(entry);
|
|
74
|
-
} else if (entry.scope === 'private-use') {
|
|
75
|
-
this.privateUse.add(entry);
|
|
76
|
-
} else if (entry.scope === 'special') {
|
|
77
|
-
this.special.add(entry);
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
case 'extlang':
|
|
81
|
-
this.extlangs.add(entry);
|
|
82
|
-
break;
|
|
83
|
-
case 'script':
|
|
84
|
-
this.scripts.add(entry);
|
|
85
|
-
break;
|
|
86
|
-
case 'region':
|
|
87
|
-
this.regions.add(entry);
|
|
88
|
-
break;
|
|
89
|
-
case 'variant':
|
|
90
|
-
this.variants.add(entry);
|
|
91
|
-
break;
|
|
92
|
-
case 'grandfathered':
|
|
93
|
-
this.grandfathered.add(entry);
|
|
94
|
-
break;
|
|
95
|
-
case 'redundant':
|
|
96
|
-
this.redundant.add(entry);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public static create(registry: RegistryFile): Result<LanguageSubtagRegistry> {
|
|
103
|
-
return captureResult(() => {
|
|
104
|
-
return new LanguageSubtagRegistry(registry);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public static createFromJson(from: unknown): Result<LanguageSubtagRegistry> {
|
|
109
|
-
return Converters.registryFile.convert(from).onSuccess(LanguageSubtagRegistry.create);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public static loadDefault(): Result<LanguageSubtagRegistry> {
|
|
113
|
-
return this.createFromJson(defaultSubtags);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public static load(root: string): Result<LanguageSubtagRegistry> {
|
|
117
|
-
return captureResult(() => {
|
|
118
|
-
const registry = Converters.loadLanguageSubtagsJsonFileSync(path.join(root)).orThrow();
|
|
119
|
-
return new LanguageSubtagRegistry(registry);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
public static loadJsonRegistryFile(root: string): Result<LanguageSubtagRegistry> {
|
|
124
|
-
return captureResult(() => {
|
|
125
|
-
const registry = JarConverters.loadJsonSubtagRegistryFileSync(path.join(root)).orThrow();
|
|
126
|
-
return new LanguageSubtagRegistry(registry);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public static loadTxtRegistryFile(root: string): Result<LanguageSubtagRegistry> {
|
|
131
|
-
return captureResult(() => {
|
|
132
|
-
const registry = JarConverters.loadTxtSubtagRegistryFileSync(path.join(root)).orThrow();
|
|
133
|
-
return new LanguageSubtagRegistry(registry);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export * from '../jar/language-subtags/tags/validate';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/* eslint-disable @rushstack/typedef-var */
|
|
24
|
-
|
|
25
|
-
import * as Model from './model';
|
|
26
|
-
import * as Validate from './validate';
|
|
27
|
-
|
|
28
|
-
import { JsonFile } from '@fgv/ts-json-base';
|
|
29
|
-
import { Converter, Converters, Result } from '@fgv/ts-utils';
|
|
30
|
-
import { datedRegistry, yearMonthDaySpec } from '../common/converters';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export const extensionSingleton = Validate.extensionSingleton.converter;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
export const languageTagExtension: Converter<Model.ILanguageTagExtension, unknown> =
|
|
41
|
-
Converters.strictObject<Model.ILanguageTagExtension>(
|
|
42
|
-
{
|
|
43
|
-
identifier: extensionSingleton,
|
|
44
|
-
description: Converters.stringArray,
|
|
45
|
-
comments: Converters.stringArray,
|
|
46
|
-
added: yearMonthDaySpec,
|
|
47
|
-
rfc: Converters.string,
|
|
48
|
-
authority: Converters.string,
|
|
49
|
-
contactEmail: Converters.string,
|
|
50
|
-
mailingList: Converters.string,
|
|
51
|
-
url: Converters.string
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
description: 'registered language tag extension'
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @internal
|
|
60
|
-
*/
|
|
61
|
-
export const languageTagExtensions = datedRegistry(languageTagExtension);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @internal
|
|
65
|
-
* @param path - path from which the extensions registry is to be loaded.
|
|
66
|
-
* @returns `Success` with the loaded language tag extensions data, o
|
|
67
|
-
* or `Failure` with details if an error occurs.
|
|
68
|
-
*/
|
|
69
|
-
export function loadLanguageTagExtensionsJsonFileSync(path: string): Result<Model.LanguageTagExtensions> {
|
|
70
|
-
return JsonFile.convertJsonFileSync(path, languageTagExtensions);
|
|
71
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import * as Model from '../../iana/language-tag-extensions/model';
|
|
24
|
-
import * as Converters from './converters';
|
|
25
|
-
import * as JarConverters from './jarConverters';
|
|
26
|
-
|
|
27
|
-
import { Result, captureResult } from '@fgv/ts-utils';
|
|
28
|
-
|
|
29
|
-
// eslint-disable-next-line @rushstack/packlets/mechanics
|
|
30
|
-
import defaultExtensions from '../../../data/iana/language-tag-extensions.json';
|
|
31
|
-
import { YearMonthDaySpec } from '../model';
|
|
32
|
-
import { TagExtensionsScope } from './extensionsScope';
|
|
33
|
-
/**
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export class LanguageTagExtensionRegistry {
|
|
37
|
-
public readonly fileDate: YearMonthDaySpec;
|
|
38
|
-
public readonly extensions: TagExtensionsScope = new TagExtensionsScope();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
protected readonly _all: Model.ILanguageTagExtension[];
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Constructs an {@link Iana.LanguageTagExtensions.LanguageTagExtensionRegistry}.
|
|
47
|
-
* @param registry - Registry file from which the registry is to be constructed.
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
protected constructor(registry: Model.LanguageTagExtensions) {
|
|
51
|
-
this.fileDate = registry.fileDate;
|
|
52
|
-
this._all = registry.entries;
|
|
53
|
-
for (const entry of this._all) {
|
|
54
|
-
this.extensions.add(entry).orThrow();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public static create(registry: Model.LanguageTagExtensions): Result<LanguageTagExtensionRegistry> {
|
|
59
|
-
return captureResult(() => {
|
|
60
|
-
return new LanguageTagExtensionRegistry(registry);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public static createFromJson(from: unknown): Result<LanguageTagExtensionRegistry> {
|
|
65
|
-
return Converters.languageTagExtensions.convert(from).onSuccess(LanguageTagExtensionRegistry.create);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public static loadDefault(): Result<LanguageTagExtensionRegistry> {
|
|
69
|
-
return this.createFromJson(defaultExtensions);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public static load(path: string): Result<LanguageTagExtensionRegistry> {
|
|
73
|
-
return captureResult(() => {
|
|
74
|
-
const registry = Converters.loadLanguageTagExtensionsJsonFileSync(path).orThrow();
|
|
75
|
-
return new LanguageTagExtensionRegistry(registry);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public static loadJsonRegistryFile(path: string): Result<LanguageTagExtensionRegistry> {
|
|
80
|
-
return captureResult(() => {
|
|
81
|
-
const registry = JarConverters.loadJsonLanguageTagExtensionsRegistryFileSync(path).orThrow();
|
|
82
|
-
return new LanguageTagExtensionRegistry(registry);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public static loadTxtRegistryFile(path: string): Result<LanguageTagExtensionRegistry> {
|
|
87
|
-
return captureResult(() => {
|
|
88
|
-
const registry = JarConverters.loadTxtLanguageTagExtensionsRegistryFileSync(path).orThrow();
|
|
89
|
-
return new LanguageTagExtensionRegistry(registry);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import * as Model from './model';
|
|
24
|
-
import * as Validate from './validate';
|
|
25
|
-
|
|
26
|
-
import { Result, succeed } from '@fgv/ts-utils';
|
|
27
|
-
|
|
28
|
-
import { RegisteredItemScope } from '../common/registeredItems';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export class TagExtensionsScope extends RegisteredItemScope<
|
|
34
|
-
'language-tag-extension',
|
|
35
|
-
Model.ExtensionSingleton,
|
|
36
|
-
Model.ILanguageTagExtension
|
|
37
|
-
> {
|
|
38
|
-
public constructor() {
|
|
39
|
-
super('language-tag-extension', Validate.extensionSingleton);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public add(entry: Model.ILanguageTagExtension): Result<true> {
|
|
43
|
-
return this._validateEntry(entry).onSuccess(() => {
|
|
44
|
-
this._items.set(entry.identifier, entry);
|
|
45
|
-
return succeed(true);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Validates a single entry from a language tag extensions data file.
|
|
51
|
-
* @param entry - The language tag extensions registry entry to be
|
|
52
|
-
* validated.
|
|
53
|
-
* @returns `Success` with `true` if the entry is valid, `Failure` with
|
|
54
|
-
* details if an error occurs.
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
protected _validateEntry(entry: Model.ILanguageTagExtension): Result<true> {
|
|
58
|
-
return this._validateKey(entry.identifier);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import * as Converters from './converters';
|
|
24
|
-
import * as JarConverters from './jarConverters';
|
|
25
|
-
import * as Model from './model';
|
|
26
|
-
import * as Validate from './validate';
|
|
27
|
-
|
|
28
|
-
export { LanguageTagExtensionRegistry } from './extensionsRegistry';
|
|
29
|
-
export { Converters, JarConverters, Model, Validate };
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
/* eslint-disable @rushstack/typedef-var */
|
|
23
|
-
|
|
24
|
-
import * as Model from './model';
|
|
25
|
-
|
|
26
|
-
import { RecordJar } from '@fgv/ts-extras';
|
|
27
|
-
import { JsonFile } from '@fgv/ts-json-base';
|
|
28
|
-
import { Converters, Result } from '@fgv/ts-utils';
|
|
29
|
-
import { datedRegistry, yearMonthDaySpec } from '../common/converters';
|
|
30
|
-
import { datedRegistryFromJarRecords } from '../jar/jarConverters';
|
|
31
|
-
import { extensionSingleton } from './validate';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export const languageTagExtension = Converters.transformObject<
|
|
37
|
-
Model.LanguageTagExtensionRegistryEntry,
|
|
38
|
-
Model.ILanguageTagExtension
|
|
39
|
-
>(
|
|
40
|
-
{
|
|
41
|
-
identifier: { from: 'Identifier', converter: extensionSingleton.converter },
|
|
42
|
-
description: { from: 'Description', converter: Converters.stringArray },
|
|
43
|
-
comments: { from: 'Comments', converter: Converters.stringArray },
|
|
44
|
-
added: { from: 'Added', converter: yearMonthDaySpec },
|
|
45
|
-
rfc: { from: 'RFC', converter: Converters.string },
|
|
46
|
-
authority: { from: 'Authority', converter: Converters.string },
|
|
47
|
-
contactEmail: { from: 'Contact_Email', converter: Converters.string },
|
|
48
|
-
mailingList: { from: 'Mailing_List', converter: Converters.string },
|
|
49
|
-
url: { from: 'URL', converter: Converters.string }
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
strict: true,
|
|
53
|
-
description: 'registered language tag extension'
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
export const languageTagExtensions = datedRegistry(languageTagExtension);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Loads language tag extensions registry data from a JSON-formatted file.
|
|
64
|
-
* @param path - String path from which registry data is to be read.
|
|
65
|
-
* @returns `Success` with the loaded language tag extension data
|
|
66
|
-
* or `Failure` with details if an error occurs.
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export function loadJsonLanguageTagExtensionsRegistryFileSync(
|
|
70
|
-
path: string
|
|
71
|
-
): Result<Model.LanguageTagExtensions> {
|
|
72
|
-
return JsonFile.convertJsonFileSync(path, languageTagExtensions);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Loads language tag extensions registry data from a text (JAR-formatted) file.
|
|
77
|
-
* @param path - String path from which registry data is to be read.
|
|
78
|
-
* @returns `Success` with the loaded language tag extension data
|
|
79
|
-
* or `Failure` with details if an error occurs.
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
export function loadTxtLanguageTagExtensionsRegistryFileSync(
|
|
83
|
-
path: string
|
|
84
|
-
): Result<Model.LanguageTagExtensions> {
|
|
85
|
-
return RecordJar.readRecordJarFileSync(path, {
|
|
86
|
-
arrayFields: ['Comments', 'Description'],
|
|
87
|
-
fixedContinuationSize: 1
|
|
88
|
-
}).onSuccess((jar) => {
|
|
89
|
-
return datedRegistryFromJarRecords(languageTagExtension).convert(jar);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
23
|
-
|
|
24
|
-
import { Brand } from '@fgv/ts-utils';
|
|
25
|
-
import { IDatedRegistry, YearMonthDaySpec } from '../model';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
export type ExtensionSingleton = Brand<string, 'ExtensionSingleton'>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
export interface LanguageTagExtensionRegistryEntry {
|
|
36
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
37
|
-
Identifier: ExtensionSingleton;
|
|
38
|
-
Description: string[];
|
|
39
|
-
Comments: string[];
|
|
40
|
-
Added: YearMonthDaySpec;
|
|
41
|
-
RFC: string;
|
|
42
|
-
Authority: string;
|
|
43
|
-
Contact_Email: string;
|
|
44
|
-
Mailing_List: string;
|
|
45
|
-
URL: string;
|
|
46
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
export interface ILanguageTagExtension {
|
|
53
|
-
identifier: ExtensionSingleton;
|
|
54
|
-
description: string[];
|
|
55
|
-
comments: string[];
|
|
56
|
-
added: YearMonthDaySpec;
|
|
57
|
-
rfc: string;
|
|
58
|
-
authority: string;
|
|
59
|
-
contactEmail: string;
|
|
60
|
-
mailingList: string;
|
|
61
|
-
url: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
export type LanguageTagExtensions = IDatedRegistry<ILanguageTagExtension>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2021 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { succeed } from '@fgv/ts-utils';
|
|
24
|
-
import { RegExpValidationHelpers } from '../../utils';
|
|
25
|
-
import * as Model from './model';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
export const extensionSingleton: RegExpValidationHelpers<Model.ExtensionSingleton> =
|
|
31
|
-
new RegExpValidationHelpers<Model.ExtensionSingleton>({
|
|
32
|
-
description: 'language tag extension singleton',
|
|
33
|
-
wellFormed: /^[0-9a-wyzA-WYZ]$/,
|
|
34
|
-
canonical: /^[0-9a-wyz]$/,
|
|
35
|
-
toCanonical: (from: Model.ExtensionSingleton) => succeed(from.toLowerCase() as Model.ExtensionSingleton)
|
|
36
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2022 Erik Fortune
|
|
3
|
-
*
|
|
4
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
* in the Software without restriction, including without limitation the rights
|
|
7
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
* furnished to do so, subject to the following conditions:
|
|
10
|
-
*
|
|
11
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
* copies or substantial portions of the Software.
|
|
13
|
-
*
|
|
14
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
* SOFTWARE.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { Result, captureResult } from '@fgv/ts-utils';
|
|
24
|
-
|
|
25
|
-
import { LanguageSubtagRegistry } from './language-subtags';
|
|
26
|
-
import { LanguageTagExtensionRegistry } from './language-tag-extensions';
|
|
27
|
-
import path from 'path';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export class LanguageRegistries {
|
|
33
|
-
public readonly subtags: LanguageSubtagRegistry;
|
|
34
|
-
public readonly extensions: LanguageTagExtensionRegistry;
|
|
35
|
-
private constructor(subtags: LanguageSubtagRegistry, extensions: LanguageTagExtensionRegistry) {
|
|
36
|
-
this.subtags = subtags;
|
|
37
|
-
this.extensions = extensions;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public static load(root: string): Result<LanguageRegistries> {
|
|
41
|
-
return captureResult(() => {
|
|
42
|
-
const subtags = LanguageSubtagRegistry.load(path.join(root, 'language-subtags.json')).orThrow();
|
|
43
|
-
const extensions = LanguageTagExtensionRegistry.load(
|
|
44
|
-
path.join(root, 'language-tag-extensions.json')
|
|
45
|
-
).orThrow();
|
|
46
|
-
return new LanguageRegistries(subtags, extensions);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public static loadDefault(): Result<LanguageRegistries> {
|
|
51
|
-
return captureResult(() => {
|
|
52
|
-
const subtags = LanguageSubtagRegistry.loadDefault().orThrow();
|
|
53
|
-
const extensions = LanguageTagExtensionRegistry.loadDefault().orThrow();
|
|
54
|
-
return new LanguageRegistries(subtags, extensions);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|