@fgv/ts-bcp47 0.9.6 → 2.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ts-bcp47.d.ts +2554 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/data/bcp/overrides.json +20 -0
- package/lib/data/iana/language-subtags.json +57439 -0
- package/{data → lib/data}/iana/language-tag-extensions.json +2 -6
- package/lib/data/unsd/m49.json +3723 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +57 -0
- package/lib/index.js.map +1 -0
- package/lib/packlets/bcp47/bcp47Subtags/converters.d.ts.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/converters.js +2 -1
- package/lib/packlets/bcp47/bcp47Subtags/converters.js.map +1 -0
- package/lib/packlets/bcp47/bcp47Subtags/index.d.ts.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/index.js +1 -1
- package/lib/packlets/bcp47/bcp47Subtags/index.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/model.d.ts +3 -1
- package/lib/packlets/bcp47/bcp47Subtags/model.d.ts.map +1 -0
- package/lib/packlets/bcp47/bcp47Subtags/model.js +24 -0
- package/lib/packlets/bcp47/bcp47Subtags/model.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/validate.d.ts +2 -2
- package/lib/packlets/bcp47/bcp47Subtags/validate.d.ts.map +1 -0
- package/lib/packlets/bcp47/bcp47Subtags/validate.js +74 -0
- package/lib/packlets/bcp47/bcp47Subtags/validate.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/common.d.ts +4 -4
- package/lib/packlets/bcp47/common.d.ts.map +1 -0
- package/lib/packlets/bcp47/common.js +59 -0
- package/lib/packlets/bcp47/common.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/helpers.d.ts +8 -8
- package/lib/packlets/bcp47/helpers.d.ts.map +1 -0
- package/lib/packlets/bcp47/helpers.js +103 -0
- package/lib/packlets/bcp47/helpers.js.map +1 -0
- package/lib/packlets/bcp47/index.d.ts +10 -0
- package/lib/packlets/bcp47/index.d.ts.map +1 -0
- package/lib/packlets/bcp47/index.js +68 -0
- package/lib/packlets/bcp47/index.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/languageRegistryData.d.ts +26 -27
- package/lib/packlets/bcp47/languageRegistryData.d.ts.map +1 -0
- package/lib/packlets/bcp47/languageRegistryData.js +206 -0
- package/lib/packlets/bcp47/languageRegistryData.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/languageTag.d.ts +12 -13
- package/lib/packlets/bcp47/languageTag.d.ts.map +1 -0
- package/lib/packlets/bcp47/languageTag.js +390 -0
- package/lib/packlets/bcp47/languageTag.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/languageTagParser.d.ts +13 -14
- package/lib/packlets/bcp47/languageTagParser.d.ts.map +1 -0
- package/lib/packlets/bcp47/languageTagParser.js +303 -0
- package/lib/packlets/bcp47/languageTagParser.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/match/chooser.d.ts +8 -8
- package/lib/packlets/bcp47/match/chooser.d.ts.map +1 -0
- package/lib/packlets/bcp47/match/chooser.js +92 -0
- package/lib/packlets/bcp47/match/chooser.js.map +1 -0
- package/lib/packlets/bcp47/match/common.d.ts.map +1 -0
- package/lib/packlets/bcp47/match/common.js +52 -0
- package/lib/packlets/bcp47/match/common.js.map +1 -0
- package/lib/packlets/bcp47/match/index.d.ts +4 -0
- package/lib/packlets/bcp47/match/index.d.ts.map +1 -0
- package/lib/packlets/bcp47/match/index.js +45 -0
- package/lib/packlets/bcp47/match/index.js.map +1 -0
- package/lib/packlets/bcp47/match/similarity.d.ts.map +1 -0
- package/lib/packlets/bcp47/match/similarity.js +230 -0
- package/lib/packlets/bcp47/match/similarity.js.map +1 -0
- package/lib/packlets/bcp47/normalization/baseNormalizer.d.ts +35 -0
- package/lib/packlets/bcp47/normalization/baseNormalizer.d.ts.map +1 -0
- package/lib/packlets/bcp47/normalization/baseNormalizer.js +116 -0
- package/lib/packlets/bcp47/normalization/baseNormalizer.js.map +1 -0
- package/lib/packlets/bcp47/normalization/canonicalNormalizer.d.ts +22 -0
- package/lib/packlets/bcp47/normalization/canonicalNormalizer.d.ts.map +1 -0
- package/lib/packlets/bcp47/normalization/canonicalNormalizer.js +113 -0
- package/lib/packlets/bcp47/normalization/canonicalNormalizer.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/normalization/common.d.ts +1 -1
- package/lib/packlets/bcp47/normalization/common.d.ts.map +1 -0
- package/lib/packlets/bcp47/normalization/common.js +82 -0
- package/lib/packlets/bcp47/normalization/common.js.map +1 -0
- package/lib/packlets/bcp47/normalization/index.d.ts.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/normalization/index.js +1 -1
- package/lib/packlets/bcp47/normalization/index.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/normalization/normalizeTag.d.ts +6 -6
- package/lib/packlets/bcp47/normalization/normalizeTag.d.ts.map +1 -0
- package/lib/packlets/bcp47/normalization/normalizeTag.js +105 -0
- package/lib/packlets/bcp47/normalization/normalizeTag.js.map +1 -0
- package/lib/packlets/bcp47/normalization/preferredTagNormalizer.d.ts +27 -0
- package/lib/packlets/bcp47/normalization/preferredTagNormalizer.d.ts.map +1 -0
- package/lib/packlets/bcp47/normalization/preferredTagNormalizer.js +204 -0
- package/lib/packlets/bcp47/normalization/preferredTagNormalizer.js.map +1 -0
- package/lib/packlets/bcp47/overrides/converters.d.ts +19 -0
- package/lib/packlets/bcp47/overrides/converters.d.ts.map +1 -0
- package/lib/packlets/bcp47/overrides/converters.js +76 -0
- package/lib/packlets/bcp47/overrides/converters.js.map +1 -0
- package/lib/packlets/bcp47/overrides/defaultRegistries.d.ts.map +1 -0
- package/lib/packlets/bcp47/overrides/defaultRegistries.js +42 -0
- package/lib/packlets/bcp47/overrides/defaultRegistries.js.map +1 -0
- package/lib/packlets/bcp47/overrides/index.d.ts.map +1 -0
- package/lib/packlets/bcp47/overrides/index.js +30 -0
- package/lib/packlets/bcp47/overrides/index.js.map +1 -0
- package/lib/packlets/bcp47/overrides/model.d.ts +11 -0
- package/lib/packlets/bcp47/overrides/model.d.ts.map +1 -0
- package/lib/packlets/bcp47/overrides/model.js +24 -0
- package/lib/packlets/bcp47/overrides/model.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/overrides/overridesRegistry.d.ts +8 -8
- package/lib/packlets/bcp47/overrides/overridesRegistry.d.ts.map +1 -0
- package/lib/packlets/bcp47/overrides/overridesRegistry.js +113 -0
- package/lib/packlets/bcp47/overrides/overridesRegistry.js.map +1 -0
- package/lib/packlets/bcp47/validation/baseValidator.d.ts +35 -0
- package/lib/packlets/bcp47/validation/baseValidator.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/baseValidator.js +113 -0
- package/lib/packlets/bcp47/validation/baseValidator.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/validation/common.d.ts +1 -1
- package/lib/packlets/bcp47/validation/common.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/common.js +84 -0
- package/lib/packlets/bcp47/validation/common.js.map +1 -0
- package/lib/packlets/bcp47/validation/index.d.ts.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/validation/index.js +1 -1
- package/lib/packlets/bcp47/validation/index.js.map +1 -0
- package/lib/packlets/bcp47/validation/isCanonical.d.ts +22 -0
- package/lib/packlets/bcp47/validation/isCanonical.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/isCanonical.js +106 -0
- package/lib/packlets/bcp47/validation/isCanonical.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/validation/isInPreferredForm.d.ts +4 -4
- package/lib/packlets/bcp47/validation/isInPreferredForm.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/isInPreferredForm.js +73 -0
- package/lib/packlets/bcp47/validation/isInPreferredForm.js.map +1 -0
- package/lib/packlets/bcp47/validation/isStrictlyValid.d.ts +18 -0
- package/lib/packlets/bcp47/validation/isStrictlyValid.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/isStrictlyValid.js +98 -0
- package/lib/packlets/bcp47/validation/isStrictlyValid.js.map +1 -0
- package/lib/packlets/bcp47/validation/isValid.d.ts +24 -0
- package/lib/packlets/bcp47/validation/isValid.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/isValid.js +119 -0
- package/lib/packlets/bcp47/validation/isValid.js.map +1 -0
- package/lib/packlets/bcp47/validation/isWellFormed.d.ts +22 -0
- package/lib/packlets/bcp47/validation/isWellFormed.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/isWellFormed.js +102 -0
- package/lib/packlets/bcp47/validation/isWellFormed.js.map +1 -0
- package/{bcp47 → lib/packlets/bcp47}/validation/validateTag.d.ts +9 -9
- package/lib/packlets/bcp47/validation/validateTag.d.ts.map +1 -0
- package/lib/packlets/bcp47/validation/validateTag.js +159 -0
- package/lib/packlets/bcp47/validation/validateTag.js.map +1 -0
- package/{iana → lib/packlets/iana}/common/converters.d.ts +2 -2
- package/lib/packlets/iana/common/converters.d.ts.map +1 -0
- package/lib/packlets/iana/common/converters.js +85 -0
- package/lib/packlets/iana/common/converters.js.map +1 -0
- package/{iana → lib/packlets/iana}/common/model.d.ts +1 -1
- package/lib/packlets/iana/common/model.d.ts.map +1 -0
- package/lib/packlets/iana/common/model.js +24 -0
- package/lib/packlets/iana/common/model.js.map +1 -0
- package/lib/packlets/iana/common/registeredItems.d.ts.map +1 -0
- package/lib/packlets/iana/common/registeredItems.js +124 -0
- package/lib/packlets/iana/common/registeredItems.js.map +1 -0
- package/lib/packlets/iana/common/utils.d.ts.map +1 -0
- package/lib/packlets/iana/common/utils.js +34 -0
- package/lib/packlets/iana/common/utils.js.map +1 -0
- package/{iana → lib/packlets/iana}/common/validate.d.ts +1 -1
- package/lib/packlets/iana/common/validate.d.ts.map +1 -0
- package/lib/packlets/iana/common/validate.js +62 -0
- package/lib/packlets/iana/common/validate.js.map +1 -0
- package/lib/packlets/iana/converters.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/converters.js +1 -1
- package/lib/packlets/iana/converters.js.map +1 -0
- package/lib/packlets/iana/defaultRegistries.d.ts.map +1 -0
- package/lib/packlets/iana/defaultRegistries.js +42 -0
- package/lib/packlets/iana/defaultRegistries.js.map +1 -0
- package/{iana → lib/packlets/iana}/index.d.ts +4 -2
- package/lib/packlets/iana/index.d.ts.map +1 -0
- package/{iana/jar/language-subtags/tags → lib/packlets/iana}/index.js +18 -6
- package/lib/packlets/iana/index.js.map +1 -0
- package/lib/packlets/iana/jar/converters.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/jar/converters.js +1 -1
- package/lib/packlets/iana/jar/converters.js.map +1 -0
- package/lib/packlets/iana/jar/index.d.ts +5 -0
- package/lib/packlets/iana/jar/index.d.ts.map +1 -0
- package/{unsd/csv → lib/packlets/iana/jar}/index.js +4 -2
- package/lib/packlets/iana/jar/index.js.map +1 -0
- package/{iana → lib/packlets/iana}/jar/jarConverters.d.ts +5 -5
- package/lib/packlets/iana/jar/jarConverters.d.ts.map +1 -0
- package/lib/packlets/iana/jar/jarConverters.js +86 -0
- package/lib/packlets/iana/jar/jarConverters.js.map +1 -0
- package/{iana → lib/packlets/iana}/jar/jarModel.d.ts +1 -1
- package/lib/packlets/iana/jar/jarModel.d.ts.map +1 -0
- package/lib/packlets/iana/jar/jarModel.js +24 -0
- package/lib/packlets/iana/jar/jarModel.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/converters.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/jar/language-subtags/converters.js +1 -1
- package/lib/packlets/iana/jar/language-subtags/converters.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/index.d.ts +5 -0
- package/lib/packlets/iana/jar/language-subtags/index.d.ts.map +1 -0
- package/{iana/jar/language-subtags/registry → lib/packlets/iana/jar/language-subtags}/index.js +29 -28
- package/lib/packlets/iana/jar/language-subtags/index.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/model.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/jar/language-subtags/model.js +1 -1
- package/lib/packlets/iana/jar/language-subtags/model.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/registry/converters.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/registry/converters.js +59 -0
- package/lib/packlets/iana/jar/language-subtags/registry/converters.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/registry/index.d.ts.map +1 -0
- package/{iana/jar/language-subtags → lib/packlets/iana/jar/language-subtags/registry}/index.js +23 -22
- package/lib/packlets/iana/jar/language-subtags/registry/index.js.map +1 -0
- package/{iana → lib/packlets/iana}/jar/language-subtags/registry/model.d.ts +12 -12
- package/lib/packlets/iana/jar/language-subtags/registry/model.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/registry/model.js +46 -0
- package/lib/packlets/iana/jar/language-subtags/registry/model.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/converters.d.ts +55 -0
- package/lib/packlets/iana/jar/language-subtags/tags/converters.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/converters.js +129 -0
- package/lib/packlets/iana/jar/language-subtags/tags/converters.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/index.d.ts +6 -0
- package/lib/packlets/iana/jar/language-subtags/tags/index.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/index.js +58 -0
- package/lib/packlets/iana/jar/language-subtags/tags/index.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/model.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/model.js +24 -0
- package/lib/packlets/iana/jar/language-subtags/tags/model.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/tagValidation.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/tagValidation.js +70 -0
- package/lib/packlets/iana/jar/language-subtags/tags/tagValidation.js.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/validate.d.ts.map +1 -0
- package/lib/packlets/iana/jar/language-subtags/tags/validate.js +88 -0
- package/lib/packlets/iana/jar/language-subtags/tags/validate.js.map +1 -0
- package/lib/packlets/iana/jar/model.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/jar/model.js +1 -1
- package/lib/packlets/iana/jar/model.js.map +1 -0
- package/lib/packlets/iana/language-subtags/common.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/common.js +24 -0
- package/lib/packlets/iana/language-subtags/common.js.map +1 -0
- package/lib/packlets/iana/language-subtags/converters.d.ts +52 -0
- package/lib/packlets/iana/language-subtags/converters.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/converters.js +209 -0
- package/lib/packlets/iana/language-subtags/converters.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/index.d.ts +4 -3
- package/lib/packlets/iana/language-subtags/index.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/index.js +10 -8
- package/lib/packlets/iana/language-subtags/index.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/jarConverters.d.ts +8 -8
- package/lib/packlets/iana/language-subtags/jarConverters.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/jarConverters.js +237 -0
- package/lib/packlets/iana/language-subtags/jarConverters.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/model.d.ts +15 -15
- package/lib/packlets/iana/language-subtags/model.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/model.js +24 -0
- package/lib/packlets/iana/language-subtags/model.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/scope.d.ts +12 -12
- package/lib/packlets/iana/language-subtags/scope.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/scope.js +179 -0
- package/lib/packlets/iana/language-subtags/scope.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/subtagRegistry.d.ts +1 -1
- package/lib/packlets/iana/language-subtags/subtagRegistry.d.ts.map +1 -0
- package/lib/packlets/iana/language-subtags/subtagRegistry.js +150 -0
- package/lib/packlets/iana/language-subtags/subtagRegistry.js.map +1 -0
- package/lib/packlets/iana/language-subtags/validate.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/language-subtags/validate.js +1 -1
- package/lib/packlets/iana/language-subtags/validate.js.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/converters.d.ts +22 -0
- package/lib/packlets/iana/language-tag-extensions/converters.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/converters.js +86 -0
- package/lib/packlets/iana/language-tag-extensions/converters.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/extensionsRegistry.d.ts +2 -2
- package/lib/packlets/iana/language-tag-extensions/extensionsRegistry.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/extensionsRegistry.js +105 -0
- package/lib/packlets/iana/language-tag-extensions/extensionsRegistry.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/extensionsScope.d.ts +3 -3
- package/lib/packlets/iana/language-tag-extensions/extensionsScope.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/extensionsScope.js +77 -0
- package/lib/packlets/iana/language-tag-extensions/extensionsScope.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/index.d.ts +3 -2
- package/lib/packlets/iana/language-tag-extensions/index.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/index.js +6 -4
- package/lib/packlets/iana/language-tag-extensions/index.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/jarConverters.d.ts +2 -3
- package/lib/packlets/iana/language-tag-extensions/jarConverters.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/jarConverters.js +79 -0
- package/lib/packlets/iana/language-tag-extensions/jarConverters.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/model.d.ts +5 -6
- package/lib/packlets/iana/language-tag-extensions/model.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/model.js +25 -0
- package/lib/packlets/iana/language-tag-extensions/model.js.map +1 -0
- package/{iana → lib/packlets/iana}/language-tag-extensions/validate.d.ts +2 -2
- package/lib/packlets/iana/language-tag-extensions/validate.d.ts.map +1 -0
- package/lib/packlets/iana/language-tag-extensions/validate.js +36 -0
- package/lib/packlets/iana/language-tag-extensions/validate.js.map +1 -0
- package/lib/packlets/iana/languageRegistries.d.ts.map +1 -0
- package/lib/packlets/iana/languageRegistries.js +56 -0
- package/lib/packlets/iana/languageRegistries.js.map +1 -0
- package/lib/packlets/iana/model.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/model.js +1 -1
- package/lib/packlets/iana/model.js.map +1 -0
- package/lib/packlets/iana/validate.d.ts.map +1 -0
- package/{iana → lib/packlets/iana}/validate.js +1 -1
- package/lib/packlets/iana/validate.js.map +1 -0
- package/lib/packlets/unsd/areas.d.ts +29 -0
- package/lib/packlets/unsd/areas.d.ts.map +1 -0
- package/lib/packlets/unsd/areas.js +96 -0
- package/lib/packlets/unsd/areas.js.map +1 -0
- package/lib/packlets/unsd/common.d.ts +49 -0
- package/lib/packlets/unsd/common.d.ts.map +1 -0
- package/lib/packlets/unsd/common.js +24 -0
- package/lib/packlets/unsd/common.js.map +1 -0
- package/{unsd → lib/packlets/unsd}/csv/converters.d.ts +7 -4
- package/lib/packlets/unsd/csv/converters.d.ts.map +1 -0
- package/lib/packlets/unsd/csv/converters.js +78 -0
- package/lib/packlets/unsd/csv/converters.js.map +1 -0
- package/lib/packlets/unsd/csv/index.d.ts.map +1 -0
- package/{iana/jar → lib/packlets/unsd/csv}/index.js +1 -1
- package/lib/packlets/unsd/csv/index.js.map +1 -0
- package/lib/packlets/unsd/csv/model.d.ts +22 -0
- package/lib/packlets/unsd/csv/model.d.ts.map +1 -0
- package/lib/packlets/unsd/csv/model.js +24 -0
- package/lib/packlets/unsd/csv/model.js.map +1 -0
- package/lib/packlets/unsd/defaultRegistries.d.ts.map +1 -0
- package/lib/packlets/unsd/defaultRegistries.js +42 -0
- package/lib/packlets/unsd/defaultRegistries.js.map +1 -0
- package/{unsd → lib/packlets/unsd}/index.d.ts +2 -0
- package/lib/packlets/unsd/index.d.ts.map +1 -0
- package/lib/packlets/unsd/index.js +58 -0
- package/lib/packlets/unsd/index.js.map +1 -0
- package/{unsd → lib/packlets/unsd}/regionCodes.d.ts +7 -7
- package/lib/packlets/unsd/regionCodes.d.ts.map +1 -0
- package/lib/packlets/unsd/regionCodes.js +122 -0
- package/lib/packlets/unsd/regionCodes.js.map +1 -0
- package/lib/packlets/unsd/regions.d.ts +21 -0
- package/lib/packlets/unsd/regions.d.ts.map +1 -0
- package/lib/packlets/unsd/regions.js +77 -0
- package/lib/packlets/unsd/regions.js.map +1 -0
- package/lib/packlets/utils/index.d.ts.map +1 -0
- package/{utils → lib/packlets/utils}/index.js +1 -1
- package/lib/packlets/utils/index.js.map +1 -0
- package/lib/packlets/utils/jsonHelpers.d.ts.map +1 -0
- package/lib/packlets/utils/jsonHelpers.js +29 -0
- package/lib/packlets/utils/jsonHelpers.js.map +1 -0
- package/lib/packlets/utils/public.d.ts +2 -0
- package/lib/packlets/utils/public.d.ts.map +1 -0
- package/lib/packlets/utils/public.js +28 -0
- package/lib/packlets/utils/public.js.map +1 -0
- package/{utils → lib/packlets/utils}/validationHelpers.d.ts +9 -10
- package/lib/packlets/utils/validationHelpers.d.ts.map +1 -0
- package/lib/packlets/utils/validationHelpers.js +120 -0
- package/lib/packlets/utils/validationHelpers.js.map +1 -0
- package/package.json +73 -67
- package/bcp47/bcp47Subtags/converters.d.ts.map +0 -1
- package/bcp47/bcp47Subtags/index.d.ts.map +0 -1
- package/bcp47/bcp47Subtags/model.d.ts.map +0 -1
- package/bcp47/bcp47Subtags/model.js +0 -24
- package/bcp47/bcp47Subtags/validate.d.ts.map +0 -1
- package/bcp47/bcp47Subtags/validate.js +0 -74
- package/bcp47/common.d.ts.map +0 -1
- package/bcp47/common.js +0 -59
- package/bcp47/helpers.d.ts.map +0 -1
- package/bcp47/helpers.js +0 -103
- package/bcp47/index.d.ts +0 -7
- package/bcp47/index.d.ts.map +0 -1
- package/bcp47/index.js +0 -27
- package/bcp47/languageRegistryData.d.ts.map +0 -1
- package/bcp47/languageRegistryData.js +0 -209
- package/bcp47/languageTag.d.ts.map +0 -1
- package/bcp47/languageTag.js +0 -390
- package/bcp47/languageTagParser.d.ts.map +0 -1
- package/bcp47/languageTagParser.js +0 -302
- package/bcp47/match/chooser.d.ts.map +0 -1
- package/bcp47/match/chooser.js +0 -92
- package/bcp47/match/common.d.ts.map +0 -1
- package/bcp47/match/common.js +0 -51
- package/bcp47/match/index.d.ts +0 -4
- package/bcp47/match/index.d.ts.map +0 -1
- package/bcp47/match/index.js +0 -45
- package/bcp47/match/similarity.d.ts.map +0 -1
- package/bcp47/match/similarity.js +0 -230
- package/bcp47/normalization/baseNormalizer.d.ts +0 -36
- package/bcp47/normalization/baseNormalizer.d.ts.map +0 -1
- package/bcp47/normalization/baseNormalizer.js +0 -114
- package/bcp47/normalization/canonicalNormalizer.d.ts +0 -22
- package/bcp47/normalization/canonicalNormalizer.d.ts.map +0 -1
- package/bcp47/normalization/canonicalNormalizer.js +0 -113
- package/bcp47/normalization/common.d.ts.map +0 -1
- package/bcp47/normalization/common.js +0 -82
- package/bcp47/normalization/index.d.ts.map +0 -1
- package/bcp47/normalization/normalizeTag.d.ts.map +0 -1
- package/bcp47/normalization/normalizeTag.js +0 -105
- package/bcp47/normalization/preferredTagNormalizer.d.ts +0 -27
- package/bcp47/normalization/preferredTagNormalizer.d.ts.map +0 -1
- package/bcp47/normalization/preferredTagNormalizer.js +0 -209
- package/bcp47/overrides/converters.d.ts +0 -19
- package/bcp47/overrides/converters.d.ts.map +0 -1
- package/bcp47/overrides/converters.js +0 -75
- package/bcp47/overrides/defaultRegistries.d.ts.map +0 -1
- package/bcp47/overrides/defaultRegistries.js +0 -42
- package/bcp47/overrides/index.d.ts.map +0 -1
- package/bcp47/overrides/index.js +0 -30
- package/bcp47/overrides/model.d.ts +0 -11
- package/bcp47/overrides/model.d.ts.map +0 -1
- package/bcp47/overrides/model.js +0 -24
- package/bcp47/overrides/overridesRegistry.d.ts.map +0 -1
- package/bcp47/overrides/overridesRegistry.js +0 -112
- package/bcp47/validation/baseValidator.d.ts +0 -35
- package/bcp47/validation/baseValidator.d.ts.map +0 -1
- package/bcp47/validation/baseValidator.js +0 -111
- package/bcp47/validation/common.d.ts.map +0 -1
- package/bcp47/validation/common.js +0 -84
- package/bcp47/validation/index.d.ts.map +0 -1
- package/bcp47/validation/isCanonical.d.ts +0 -22
- package/bcp47/validation/isCanonical.d.ts.map +0 -1
- package/bcp47/validation/isCanonical.js +0 -104
- package/bcp47/validation/isInPreferredForm.d.ts.map +0 -1
- package/bcp47/validation/isInPreferredForm.js +0 -73
- package/bcp47/validation/isStrictlyValid.d.ts +0 -18
- package/bcp47/validation/isStrictlyValid.d.ts.map +0 -1
- package/bcp47/validation/isStrictlyValid.js +0 -98
- package/bcp47/validation/isValid.d.ts +0 -24
- package/bcp47/validation/isValid.d.ts.map +0 -1
- package/bcp47/validation/isValid.js +0 -115
- package/bcp47/validation/isWellFormed.d.ts +0 -22
- package/bcp47/validation/isWellFormed.d.ts.map +0 -1
- package/bcp47/validation/isWellFormed.js +0 -98
- package/bcp47/validation/validateTag.d.ts.map +0 -1
- package/bcp47/validation/validateTag.js +0 -159
- package/data/bcp/overrides.json +0 -21
- package/data/iana/language-subtags.json +0 -77295
- package/data/unsd/m49.json +0 -251
- package/iana/common/converters.d.ts.map +0 -1
- package/iana/common/converters.js +0 -84
- package/iana/common/model.d.ts.map +0 -1
- package/iana/common/model.js +0 -24
- package/iana/common/registeredItems.d.ts.map +0 -1
- package/iana/common/registeredItems.js +0 -124
- package/iana/common/utils.d.ts.map +0 -1
- package/iana/common/utils.js +0 -34
- package/iana/common/validate.d.ts.map +0 -1
- package/iana/common/validate.js +0 -61
- package/iana/converters.d.ts.map +0 -1
- package/iana/defaultRegistries.d.ts.map +0 -1
- package/iana/defaultRegistries.js +0 -42
- package/iana/index.d.ts.map +0 -1
- package/iana/index.js +0 -64
- package/iana/jar/converters.d.ts.map +0 -1
- package/iana/jar/index.d.ts.map +0 -1
- package/iana/jar/jarConverters.d.ts.map +0 -1
- package/iana/jar/jarConverters.js +0 -85
- package/iana/jar/jarModel.d.ts.map +0 -1
- package/iana/jar/jarModel.js +0 -24
- package/iana/jar/language-subtags/converters.d.ts.map +0 -1
- package/iana/jar/language-subtags/index.d.ts.map +0 -1
- package/iana/jar/language-subtags/model.d.ts.map +0 -1
- package/iana/jar/language-subtags/registry/converters.d.ts.map +0 -1
- package/iana/jar/language-subtags/registry/converters.js +0 -58
- package/iana/jar/language-subtags/registry/index.d.ts +0 -4
- package/iana/jar/language-subtags/registry/index.d.ts.map +0 -1
- package/iana/jar/language-subtags/registry/model.d.ts.map +0 -1
- package/iana/jar/language-subtags/registry/model.js +0 -41
- package/iana/jar/language-subtags/tags/converters.d.ts +0 -55
- package/iana/jar/language-subtags/tags/converters.d.ts.map +0 -1
- package/iana/jar/language-subtags/tags/converters.js +0 -128
- package/iana/jar/language-subtags/tags/index.d.ts +0 -5
- package/iana/jar/language-subtags/tags/index.d.ts.map +0 -1
- package/iana/jar/language-subtags/tags/model.d.ts.map +0 -1
- package/iana/jar/language-subtags/tags/model.js +0 -24
- package/iana/jar/language-subtags/tags/tagValidation.d.ts.map +0 -1
- package/iana/jar/language-subtags/tags/tagValidation.js +0 -70
- package/iana/jar/language-subtags/tags/validate.d.ts.map +0 -1
- package/iana/jar/language-subtags/tags/validate.js +0 -87
- package/iana/jar/model.d.ts.map +0 -1
- package/iana/language-subtags/common.d.ts.map +0 -1
- package/iana/language-subtags/common.js +0 -24
- package/iana/language-subtags/converters.d.ts +0 -52
- package/iana/language-subtags/converters.d.ts.map +0 -1
- package/iana/language-subtags/converters.js +0 -200
- package/iana/language-subtags/index.d.ts.map +0 -1
- package/iana/language-subtags/jarConverters.d.ts.map +0 -1
- package/iana/language-subtags/jarConverters.js +0 -213
- package/iana/language-subtags/model.d.ts.map +0 -1
- package/iana/language-subtags/model.js +0 -24
- package/iana/language-subtags/scope.d.ts.map +0 -1
- package/iana/language-subtags/scope.js +0 -179
- package/iana/language-subtags/subtagRegistry.d.ts.map +0 -1
- package/iana/language-subtags/subtagRegistry.js +0 -149
- package/iana/language-subtags/validate.d.ts.map +0 -1
- package/iana/language-tag-extensions/converters.d.ts +0 -23
- package/iana/language-tag-extensions/converters.d.ts.map +0 -1
- package/iana/language-tag-extensions/converters.js +0 -87
- package/iana/language-tag-extensions/extensionsRegistry.d.ts.map +0 -1
- package/iana/language-tag-extensions/extensionsRegistry.js +0 -104
- package/iana/language-tag-extensions/extensionsScope.d.ts.map +0 -1
- package/iana/language-tag-extensions/extensionsScope.js +0 -77
- package/iana/language-tag-extensions/index.d.ts.map +0 -1
- package/iana/language-tag-extensions/jarConverters.d.ts.map +0 -1
- package/iana/language-tag-extensions/jarConverters.js +0 -102
- package/iana/language-tag-extensions/model.d.ts.map +0 -1
- package/iana/language-tag-extensions/model.js +0 -24
- package/iana/language-tag-extensions/validate.d.ts.map +0 -1
- package/iana/language-tag-extensions/validate.js +0 -36
- package/iana/languageRegistries.d.ts.map +0 -1
- package/iana/languageRegistries.js +0 -56
- package/iana/model.d.ts.map +0 -1
- package/iana/validate.d.ts.map +0 -1
- package/index.d.ts +0 -6
- package/index.d.ts.map +0 -1
- package/index.js +0 -56
- package/unsd/areas.d.ts +0 -29
- package/unsd/areas.d.ts.map +0 -1
- package/unsd/areas.js +0 -96
- package/unsd/common.d.ts +0 -49
- package/unsd/common.d.ts.map +0 -1
- package/unsd/common.js +0 -24
- package/unsd/csv/converters.d.ts.map +0 -1
- package/unsd/csv/converters.js +0 -70
- package/unsd/csv/index.d.ts +0 -4
- package/unsd/csv/index.d.ts.map +0 -1
- package/unsd/csv/model.d.ts +0 -22
- package/unsd/csv/model.d.ts.map +0 -1
- package/unsd/csv/model.js +0 -24
- package/unsd/defaultRegistries.d.ts.map +0 -1
- package/unsd/defaultRegistries.js +0 -42
- package/unsd/index.d.ts.map +0 -1
- package/unsd/index.js +0 -44
- package/unsd/regionCodes.d.ts.map +0 -1
- package/unsd/regionCodes.js +0 -121
- package/unsd/regions.d.ts +0 -21
- package/unsd/regions.d.ts.map +0 -1
- package/unsd/regions.js +0 -77
- package/utils/index.d.ts.map +0 -1
- package/utils/jsonHelpers.d.ts.map +0 -1
- package/utils/jsonHelpers.js +0 -29
- package/utils/public.d.ts +0 -2
- package/utils/public.d.ts.map +0 -1
- package/utils/public.js +0 -28
- package/utils/validationHelpers.d.ts.map +0 -1
- package/utils/validationHelpers.js +0 -120
- /package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/converters.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/bcp47Subtags/index.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/match/common.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/match/similarity.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/normalization/index.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/overrides/defaultRegistries.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/overrides/index.d.ts +0 -0
- /package/{bcp47 → lib/packlets/bcp47}/validation/index.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/common/registeredItems.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/common/utils.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/converters.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/defaultRegistries.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/converters.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/converters.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/model.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/registry/converters.d.ts +0 -0
- /package/{iana/jar/language-subtags → lib/packlets/iana/jar/language-subtags/registry}/index.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/tags/model.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/tags/tagValidation.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/language-subtags/tags/validate.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/jar/model.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/language-subtags/common.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/language-subtags/validate.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/languageRegistries.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/model.d.ts +0 -0
- /package/{iana → lib/packlets/iana}/validate.d.ts +0 -0
- /package/{iana/jar → lib/packlets/unsd/csv}/index.d.ts +0 -0
- /package/{unsd → lib/packlets/unsd}/defaultRegistries.d.ts +0 -0
- /package/{utils → lib/packlets/utils}/index.d.ts +0 -0
- /package/{utils → lib/packlets/utils}/jsonHelpers.d.ts +0 -0
|
@@ -0,0 +1,2554 @@
|
|
|
1
|
+
import { Brand } from '@fgv/ts-utils';
|
|
2
|
+
import { Conversion } from '@fgv/ts-utils';
|
|
3
|
+
import { Converter } from '@fgv/ts-utils';
|
|
4
|
+
import { RecordJar } from '@fgv/ts-utils';
|
|
5
|
+
import { Result } from '@fgv/ts-utils';
|
|
6
|
+
import { Validation } from '@fgv/ts-utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
declare const allRegistryEntryScopes: RegistryEntryScope[];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
declare const allRegistryEntryTypes: RegistryEntryType[];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
declare class Areas {
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
protected _m49: Map<Iana.Model.UnM49RegionCode, ICountryOrArea>;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
protected _isoAlpha2: Map<Iana.Model.IsoAlpha2RegionCode, ICountryOrArea>;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
protected _isoAlpha3: Map<Iana.Model.IsoAlpha3RegionCode, ICountryOrArea>;
|
|
34
|
+
addArea(area: ICountryOrArea): Result<ICountryOrArea>;
|
|
35
|
+
tryGetArea(from: Iana.Model.UnM49RegionCode): ICountryOrArea | undefined;
|
|
36
|
+
tryGetAlpha2Area(from: Iana.Model.IsoAlpha2RegionCode): ICountryOrArea | undefined;
|
|
37
|
+
tryGetAlpha3Area(from: Iana.Model.IsoAlpha3RegionCode): ICountryOrArea | undefined;
|
|
38
|
+
getArea(from: Iana.Model.UnM49RegionCode): Result<ICountryOrArea>;
|
|
39
|
+
getAlpha2Area(from: Iana.Model.IsoAlpha2RegionCode): Result<ICountryOrArea>;
|
|
40
|
+
getAlpha3Area(from: Iana.Model.IsoAlpha3RegionCode): Result<ICountryOrArea>;
|
|
41
|
+
getAll(): ICountryOrArea[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare namespace Bcp47 {
|
|
45
|
+
export {
|
|
46
|
+
ExtensionSingleton,
|
|
47
|
+
ExtensionSubtag,
|
|
48
|
+
IExtensionSubtagValue,
|
|
49
|
+
ISubtags,
|
|
50
|
+
subtagsToString,
|
|
51
|
+
ILanguageTagInitOptions,
|
|
52
|
+
LanguageTag,
|
|
53
|
+
ILanguageChooserOptions,
|
|
54
|
+
LanguageSimilarityMatcher,
|
|
55
|
+
TagSimilarity,
|
|
56
|
+
tagSimilarity,
|
|
57
|
+
NormalizeTag,
|
|
58
|
+
TagNormalization,
|
|
59
|
+
TagValidity,
|
|
60
|
+
ValidateTag,
|
|
61
|
+
Overrides,
|
|
62
|
+
Subtags,
|
|
63
|
+
tag,
|
|
64
|
+
tags,
|
|
65
|
+
similarity,
|
|
66
|
+
choose,
|
|
67
|
+
LanguageSpec
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export { Bcp47 }
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Matches a list of desired {@link Bcp47.LanguageSpec | languages} to a list of available {@link Bcp47.LanguageSpec | languages},
|
|
74
|
+
* return a list of matching languages ordered from best to worst.
|
|
75
|
+
* @param desired - An array of {@link Bcp47.LanguageSpec | language specifications} containing an ordered list of preferred languages.
|
|
76
|
+
* @param available - An array of {@link Bcp47.LanguageSpec | language specifications} containing an unordered list of available languages.
|
|
77
|
+
* @param options - (optional) Parameters to control language tag conversion or comparison
|
|
78
|
+
* @returns `Success` with an ordered list of matching {@link Bcp47.LanguageTag | languages}, or `Failure` with details if
|
|
79
|
+
* an error occurs.
|
|
80
|
+
* @public
|
|
81
|
+
*/
|
|
82
|
+
declare function choose(desired: LanguageSpec[], available: LanguageSpec[], options?: ILanguageTagInitOptions & ILanguageChooserOptions): Result<LanguageTag[]>;
|
|
83
|
+
|
|
84
|
+
declare namespace Converters {
|
|
85
|
+
export {
|
|
86
|
+
Jar,
|
|
87
|
+
datedRegistry,
|
|
88
|
+
yearMonthDaySpec,
|
|
89
|
+
isoAlpha2RegionCode,
|
|
90
|
+
isoAlpha3RegionCode,
|
|
91
|
+
unM49RegionCode
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare namespace Converters_2 {
|
|
96
|
+
export {
|
|
97
|
+
LanguageSubtags,
|
|
98
|
+
datedRegistryFromJarRecords,
|
|
99
|
+
fileDateEntry
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare namespace Converters_3 {
|
|
104
|
+
export {
|
|
105
|
+
Registry,
|
|
106
|
+
LanguageSubtags as Tags
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare namespace Converters_4 {
|
|
111
|
+
export {
|
|
112
|
+
loadLanguageSubtagsJsonFileSync,
|
|
113
|
+
LanguageSubtags as Tags,
|
|
114
|
+
extendedLanguageRange_3 as extendedLanguageRange,
|
|
115
|
+
registeredLanguage,
|
|
116
|
+
registeredExtLang,
|
|
117
|
+
registeredScript,
|
|
118
|
+
registeredRegion,
|
|
119
|
+
registeredVariant,
|
|
120
|
+
registeredGrandfatheredTag,
|
|
121
|
+
registeredRedundantTag,
|
|
122
|
+
registeredItem,
|
|
123
|
+
registryFile
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare namespace Converters_5 {
|
|
128
|
+
export {
|
|
129
|
+
loadLanguageTagExtensionsJsonFileSync,
|
|
130
|
+
extensionSingleton,
|
|
131
|
+
languageTagExtension,
|
|
132
|
+
languageTagExtensions
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare namespace Converters_6 {
|
|
137
|
+
export {
|
|
138
|
+
loadM49csvFileSync,
|
|
139
|
+
regionTier,
|
|
140
|
+
m49CsvRow,
|
|
141
|
+
m49CsvFile
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare namespace Converters_7 {
|
|
146
|
+
export {
|
|
147
|
+
extensionSubtag,
|
|
148
|
+
privateUsePrefix
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
declare namespace Csv {
|
|
153
|
+
export {
|
|
154
|
+
Converters_6 as Converters,
|
|
155
|
+
Model_6 as Model
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Helper function which creates a converter that returns a validated {@Link Iana.Model.DatedRegistry | DatedRegistry}
|
|
161
|
+
* containing entries of supplied template type `T`.
|
|
162
|
+
* @param entryConverter - A `Converter<T>` to validate each entry
|
|
163
|
+
* @returns A new validating `Converter` which yields {@Link Iana.Model.DatedRegistry | DatedRegistry<T>}
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
declare function datedRegistry<T, TC = unknown>(entryConverter: Converter<T, TC>): Converter<IDatedRegistry<T>, TC>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Helper function which creates a converter that returns a validated {@Link Iana.Model.DatedRegistry | DatedRegistry}
|
|
170
|
+
* containing entries of supplied template type `T`.
|
|
171
|
+
* @param entryConverter - A `Converter<T>` to validate each entry
|
|
172
|
+
* @returns A new validating `Converter` which yields {@Link Iana.Model.DatedRegistry | DatedRegistry<T>}
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
declare function datedRegistryFromJarRecords<T, TC = unknown>(entryConverter: Converter<T, TC>): Converter<IDatedRegistry<T>, TC>;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
declare class DefaultRegistries {
|
|
181
|
+
/**
|
|
182
|
+
* @internal
|
|
183
|
+
*/
|
|
184
|
+
protected static _languageRegistries?: LanguageRegistries;
|
|
185
|
+
static get languageRegistries(): LanguageRegistries;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @public
|
|
190
|
+
*/
|
|
191
|
+
declare class DefaultRegistries_2 {
|
|
192
|
+
/**
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
protected static _regionCodes?: RegionCodes;
|
|
196
|
+
static get regionCodes(): RegionCodes;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
declare class DefaultRegistries_3 {
|
|
203
|
+
/**
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
private static _overridesRegistry?;
|
|
207
|
+
static get overridesRegistry(): OverridesRegistry;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
declare function endOfTagRangeOrUndefined<TTAG extends string>(tagConverter: Converter<TTAG>): Converter<TTAG | undefined>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* An extended language subtag as used in the IANA language registry.
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
declare type ExtendedLanguageRange = Brand<string, 'ExtendedLanguageRange'>;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
224
|
+
declare const extendedLanguageRange: Conversion.Converter<ExtendedLanguageRange, unknown>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @public
|
|
228
|
+
*/
|
|
229
|
+
declare const extendedLanguageRange_2: TagValidationHelpers<ExtendedLanguageRange, unknown>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
declare const extendedLanguageRange_3: Converter<ExtendedLanguageRange, unknown>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @public
|
|
238
|
+
*/
|
|
239
|
+
declare type ExtensionSingleton = Iana.LanguageTagExtensions.Model.ExtensionSingleton;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
declare const extensionSingleton: Converter<Model_2.ExtensionSingleton, unknown>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
declare type ExtensionSingleton_2 = Brand<string, 'ExtensionSingleton'>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @public
|
|
253
|
+
*/
|
|
254
|
+
declare const extensionSingleton_2: RegExpValidationHelpers<Model_2.ExtensionSingleton>;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
declare const extensionSingleton_3: RegExpValidationHelpers<Iana.LanguageTagExtensions.Model.ExtensionSingleton, unknown>;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @public
|
|
263
|
+
*/
|
|
264
|
+
declare type ExtensionSubtag = Brand<string, 'ExtensionSubtag'>;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @internal
|
|
268
|
+
*/
|
|
269
|
+
declare const extensionSubtag: Converter<ExtensionSubtag, unknown>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
declare const extensionSubtag_2: RegExpValidationHelpers<Model_8.ExtensionSubtag, unknown>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @internal
|
|
278
|
+
*/
|
|
279
|
+
declare const extlangPrefix: Conversion.Converter<LanguageSubtag, unknown>;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Extlang subtag in the IANA language subtag registry.
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
declare type ExtLangSubtag = Brand<string, 'ExtLangSubtag'>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @public
|
|
289
|
+
*/
|
|
290
|
+
declare const extlangSubtag: Conversion.Converter<ExtLangSubtag, unknown>;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
|
+
declare const extlangSubtag_2: RegExpValidationHelpers<ExtLangSubtag, unknown>;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @internal
|
|
299
|
+
*/
|
|
300
|
+
declare type ExtLangSubtagRegistryEntry = IRegistrySubtagEntry<'extlang', ExtLangSubtag>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @public
|
|
304
|
+
*/
|
|
305
|
+
declare class ExtLangSubtagScope extends SubtagScope<'extlang', ExtLangSubtag, Items.IRegisteredExtLang> {
|
|
306
|
+
constructor();
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Converter for the file date record found at the start of a registry file.
|
|
311
|
+
* @public
|
|
312
|
+
*/
|
|
313
|
+
declare const fileDateEntry: Conversion.ObjectConverter<IFileDateEntry, unknown>;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Legacy language tag registered as grandfathered in the IANA language subtag registry.
|
|
317
|
+
* @public
|
|
318
|
+
*/
|
|
319
|
+
declare type GrandfatheredTag = Brand<string, 'GrandfatheredTag'>;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @public
|
|
323
|
+
*/
|
|
324
|
+
declare const grandfatheredTag: Conversion.Converter<GrandfatheredTag, unknown>;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
declare const grandfatheredTag_2: TagValidationHelpers<GrandfatheredTag, unknown>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
declare type GrandfatheredTagRegistryEntry = IRegistryTagEntry<'grandfathered', GrandfatheredTag>;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @public
|
|
338
|
+
*/
|
|
339
|
+
declare class GrandfatheredTagScope extends TagScope<'grandfathered', GrandfatheredTag, Items.IRegisteredGrandfatheredTag> {
|
|
340
|
+
constructor();
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare namespace Helpers {
|
|
344
|
+
export {
|
|
345
|
+
TagValidationHelpers
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
declare namespace Iana {
|
|
350
|
+
export {
|
|
351
|
+
DefaultRegistries,
|
|
352
|
+
Converters,
|
|
353
|
+
Jar_2 as Jar,
|
|
354
|
+
Model_4 as Model,
|
|
355
|
+
LanguageSubtags_4 as LanguageSubtags,
|
|
356
|
+
LanguageTagExtensions_2 as LanguageTagExtensions,
|
|
357
|
+
Validate_3 as Validate,
|
|
358
|
+
nowAsYearMonthDay,
|
|
359
|
+
LanguageRegistries
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
export { Iana }
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
declare interface ICountryOrArea {
|
|
368
|
+
name: string;
|
|
369
|
+
code: Iana.Model.UnM49RegionCode;
|
|
370
|
+
tier: 'area';
|
|
371
|
+
parent: Region;
|
|
372
|
+
isoAlpha2?: Iana.Model.IsoAlpha2RegionCode;
|
|
373
|
+
isoAlpha3?: Iana.Model.IsoAlpha3RegionCode;
|
|
374
|
+
leastDevelopedCountry: boolean;
|
|
375
|
+
landlockedDevelopingCountry: boolean;
|
|
376
|
+
smallIslandDevelopingState: boolean;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* A dated collection of registry entries of a specified templated type.
|
|
381
|
+
* @public
|
|
382
|
+
*/
|
|
383
|
+
declare interface IDatedRegistry<T> {
|
|
384
|
+
fileDate: YearMonthDaySpec_2;
|
|
385
|
+
entries: T[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
391
|
+
declare interface IExtensionSubtagValue {
|
|
392
|
+
readonly singleton: ExtensionSingleton;
|
|
393
|
+
readonly value: ExtensionSubtag;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* File date record entry typically placed at the head of a registry
|
|
398
|
+
* file.
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
declare interface IFileDateEntry extends RecordJar.JarRecord {
|
|
402
|
+
'File-Date': YearMonthDaySpec_2;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* @public
|
|
407
|
+
*/
|
|
408
|
+
declare interface IGlobalRegion {
|
|
409
|
+
name: string;
|
|
410
|
+
code: Iana.Model.UnM49RegionCode;
|
|
411
|
+
tier: 'global';
|
|
412
|
+
regions: IIntermediateRegion[];
|
|
413
|
+
areas: ICountryOrArea[];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @public
|
|
418
|
+
*/
|
|
419
|
+
declare interface IIntermediateRegion {
|
|
420
|
+
name: string;
|
|
421
|
+
code: Iana.Model.UnM49RegionCode;
|
|
422
|
+
tier: RegionTier;
|
|
423
|
+
parent: Region;
|
|
424
|
+
regions: IIntermediateRegion[];
|
|
425
|
+
areas: ICountryOrArea[];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Options for {@link Bcp47.choose | language tag list filter} functions.
|
|
430
|
+
* @public
|
|
431
|
+
*/
|
|
432
|
+
declare interface ILanguageChooserOptions {
|
|
433
|
+
/**
|
|
434
|
+
* Indicates whether to return the matching language from the
|
|
435
|
+
* desired list or the available list. Default is `'availableLanguage'`.
|
|
436
|
+
*/
|
|
437
|
+
use?: 'desiredLanguage' | 'availableLanguage';
|
|
438
|
+
/**
|
|
439
|
+
* Indicates how to filter the language list - `'primaryLanguage'`
|
|
440
|
+
* indicates the each primary language should appear only once in
|
|
441
|
+
* the list in its most similar form. A filter value of `'none'`
|
|
442
|
+
* reports all matching variants of any primary language in order
|
|
443
|
+
* of similarity. Default is `'primaryLanguage'`
|
|
444
|
+
*/
|
|
445
|
+
filter?: 'primaryLanguage' | 'none';
|
|
446
|
+
/**
|
|
447
|
+
* An optional {@link Bcp47.LanguageSpec | language specification}
|
|
448
|
+
* indicating a language to be returned if the filter call would
|
|
449
|
+
* otherwise return an empty list (i.e. no languages match).
|
|
450
|
+
*/
|
|
451
|
+
ultimateFallback?: string | ISubtags | LanguageTag;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
declare interface ILanguageOverride {
|
|
458
|
+
language: Iana.LanguageSubtags.LanguageSubtag;
|
|
459
|
+
preferredRegion?: Iana.LanguageSubtags.RegionSubtag;
|
|
460
|
+
defaultAffinity?: string;
|
|
461
|
+
affinity?: Map<Iana.LanguageSubtags.RegionSubtag, string>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
467
|
+
declare interface ILanguageOverrideRecord {
|
|
468
|
+
language: Iana.LanguageSubtags.LanguageSubtag;
|
|
469
|
+
preferredRegion?: Iana.LanguageSubtags.RegionSubtag;
|
|
470
|
+
defaultAffinity?: string;
|
|
471
|
+
affinity?: Record<string, Iana.LanguageSubtags.RegionSubtag[]>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* @internal
|
|
476
|
+
*/
|
|
477
|
+
declare interface ILanguageTagExtension {
|
|
478
|
+
identifier: ExtensionSingleton_2;
|
|
479
|
+
description: string[];
|
|
480
|
+
comments: string[];
|
|
481
|
+
added: YearMonthDaySpec_2;
|
|
482
|
+
rfc: string;
|
|
483
|
+
authority: string;
|
|
484
|
+
contactEmail: string;
|
|
485
|
+
mailingList: string;
|
|
486
|
+
url: string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Initialization options for parsing or creation of {@link Bcp47.LanguageTag | language tag} objects.
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
493
|
+
declare interface ILanguageTagInitOptions {
|
|
494
|
+
/**
|
|
495
|
+
* Desired {@link Bcp47.TagValidity | validity level} (optional).
|
|
496
|
+
*/
|
|
497
|
+
validity?: TagValidity;
|
|
498
|
+
/**
|
|
499
|
+
* Desired {@link Bcp47.TagNormalization | normalization level} (optional).
|
|
500
|
+
*/
|
|
501
|
+
normalization?: TagNormalization;
|
|
502
|
+
/**
|
|
503
|
+
* The {@link Iana.LanguageRegistries | IANA language subtag and extension registries} to
|
|
504
|
+
* be used for the request (optional).
|
|
505
|
+
*/
|
|
506
|
+
iana?: Iana.LanguageRegistries;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* @internal
|
|
511
|
+
*/
|
|
512
|
+
declare interface IM49CsvRow {
|
|
513
|
+
globalCode: Iana.Model.UnM49RegionCode;
|
|
514
|
+
globalName: string;
|
|
515
|
+
regionCode?: Iana.Model.UnM49RegionCode;
|
|
516
|
+
regionName?: string;
|
|
517
|
+
subRegionCode?: Iana.Model.UnM49RegionCode;
|
|
518
|
+
subRegionName?: string;
|
|
519
|
+
intermediateRegionCode?: Iana.Model.UnM49RegionCode;
|
|
520
|
+
intermediateRegionName?: string;
|
|
521
|
+
countryOrArea: string;
|
|
522
|
+
m49Code: Iana.Model.UnM49RegionCode;
|
|
523
|
+
isoAlpha2RegionCode?: Iana.Model.IsoAlpha2RegionCode;
|
|
524
|
+
isoAlpha3RegionCode?: Iana.Model.IsoAlpha3RegionCode;
|
|
525
|
+
leastDevelopedCountry: boolean;
|
|
526
|
+
landLockedDevelopingCountry: boolean;
|
|
527
|
+
smallIslandDevelopingState: boolean;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @public
|
|
532
|
+
*/
|
|
533
|
+
declare type IntermediateRegionTier = 'region' | 'subRegion' | 'intermediateRegion';
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* @internal
|
|
537
|
+
*/
|
|
538
|
+
declare interface IRegExpValidationHelperConstructorParams<T extends string, TC = unknown> {
|
|
539
|
+
description: string;
|
|
540
|
+
wellFormed: RegExp;
|
|
541
|
+
canonical: RegExp;
|
|
542
|
+
toCanonical?: Normalizer<T, TC>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Represents a single extension subtag with corresponding registry data,
|
|
547
|
+
* if present.
|
|
548
|
+
* @public
|
|
549
|
+
*/
|
|
550
|
+
declare interface IRegisteredExtensionValue extends IExtensionSubtagValue {
|
|
551
|
+
/**
|
|
552
|
+
* The language extensions registry entry for the associated subtag,
|
|
553
|
+
* or `undefined` if the extension is not registered.
|
|
554
|
+
*/
|
|
555
|
+
registry?: Iana.LanguageTagExtensions.Model.ILanguageTagExtension;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* @public
|
|
560
|
+
*/
|
|
561
|
+
declare interface IRegisteredExtLang extends IRegisteredSubtag<'extlang', ExtLangSubtag> {
|
|
562
|
+
readonly type: 'extlang';
|
|
563
|
+
readonly subtag: ExtLangSubtag;
|
|
564
|
+
readonly preferredValue: ExtendedLanguageRange;
|
|
565
|
+
readonly prefix: LanguageSubtag;
|
|
566
|
+
readonly description: string[];
|
|
567
|
+
readonly added: Model.YearMonthDaySpec;
|
|
568
|
+
readonly comments?: string[];
|
|
569
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
570
|
+
readonly macrolanguage?: LanguageSubtag;
|
|
571
|
+
readonly scope?: Model.RegistryEntryScope;
|
|
572
|
+
readonly suppressScript?: ScriptSubtag;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Represents a single extlang subtag with corresponding registry data,
|
|
577
|
+
* if present.
|
|
578
|
+
* @public
|
|
579
|
+
*/
|
|
580
|
+
declare interface IRegisteredExtLangValue {
|
|
581
|
+
/**
|
|
582
|
+
* A {@link Iana.LanguageSubtags.ExtLangSubtag | extlang subtag} from
|
|
583
|
+
* the original language tag.
|
|
584
|
+
*/
|
|
585
|
+
subtag: Iana.LanguageSubtags.ExtLangSubtag;
|
|
586
|
+
/**
|
|
587
|
+
* The {@link Iana.LanguageSubtag.Model.RegisteredExtLang | IANA subtag registry entry}
|
|
588
|
+
* for this subtag, or `undefined` if the subtag is not registered.
|
|
589
|
+
*/
|
|
590
|
+
registry?: Iana.LanguageSubtags.Model.IRegisteredExtLang;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* @public
|
|
595
|
+
*/
|
|
596
|
+
declare interface IRegisteredGrandfatheredTag extends IRegisteredTag<'grandfathered', GrandfatheredTag> {
|
|
597
|
+
readonly type: 'grandfathered';
|
|
598
|
+
readonly tag: GrandfatheredTag;
|
|
599
|
+
readonly description: string[];
|
|
600
|
+
readonly added: Model.YearMonthDaySpec;
|
|
601
|
+
readonly comments?: string[];
|
|
602
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
603
|
+
readonly preferredValue?: ExtendedLanguageRange;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* @public
|
|
608
|
+
*/
|
|
609
|
+
declare interface IRegisteredLanguage extends IRegisteredSubtagWithRange<'language', LanguageSubtag> {
|
|
610
|
+
readonly type: 'language';
|
|
611
|
+
readonly subtag: LanguageSubtag;
|
|
612
|
+
readonly description: string[];
|
|
613
|
+
readonly added: Model.YearMonthDaySpec;
|
|
614
|
+
readonly comments?: string[];
|
|
615
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
616
|
+
readonly macrolanguage?: LanguageSubtag;
|
|
617
|
+
readonly preferredValue?: LanguageSubtag;
|
|
618
|
+
readonly scope?: Model.RegistryEntryScope;
|
|
619
|
+
readonly suppressScript?: ScriptSubtag;
|
|
620
|
+
readonly subtagRangeEnd?: LanguageSubtag;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
declare interface IRegisteredRedundantTag extends IRegisteredTag<'redundant', RedundantTag> {
|
|
627
|
+
readonly type: 'redundant';
|
|
628
|
+
readonly tag: RedundantTag;
|
|
629
|
+
readonly description: string[];
|
|
630
|
+
readonly added: Model.YearMonthDaySpec;
|
|
631
|
+
readonly comments?: string[];
|
|
632
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
633
|
+
readonly preferredValue?: ExtendedLanguageRange;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* @public
|
|
638
|
+
*/
|
|
639
|
+
declare interface IRegisteredRegion extends IRegisteredSubtagWithRange<'region', RegionSubtag> {
|
|
640
|
+
readonly type: 'region';
|
|
641
|
+
readonly subtag: RegionSubtag;
|
|
642
|
+
readonly description: string[];
|
|
643
|
+
readonly added: Model.YearMonthDaySpec;
|
|
644
|
+
readonly comments?: string[];
|
|
645
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
646
|
+
readonly preferredValue?: RegionSubtag;
|
|
647
|
+
readonly subtagRangeEnd?: RegionSubtag;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* @public
|
|
652
|
+
*/
|
|
653
|
+
declare interface IRegisteredScript extends IRegisteredSubtagWithRange<'script', ScriptSubtag> {
|
|
654
|
+
readonly type: 'script';
|
|
655
|
+
readonly subtag: ScriptSubtag;
|
|
656
|
+
readonly description: string[];
|
|
657
|
+
readonly added: Model.YearMonthDaySpec;
|
|
658
|
+
readonly comments?: string[];
|
|
659
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
660
|
+
readonly preferredValue?: ScriptSubtag;
|
|
661
|
+
readonly subtagRangeEnd?: ScriptSubtag;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* @public
|
|
666
|
+
*/
|
|
667
|
+
declare interface IRegisteredSubtag<TTYPE extends Model.RegistryEntryType, TTAG extends string> {
|
|
668
|
+
readonly type: TTYPE;
|
|
669
|
+
readonly subtag: TTAG;
|
|
670
|
+
readonly description: string[];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* @public
|
|
675
|
+
*/
|
|
676
|
+
declare interface IRegisteredSubtagWithRange<TTYPE extends Model.RegistryEntryType, TTAG extends string> extends IRegisteredSubtag<TTYPE, TTAG> {
|
|
677
|
+
readonly type: TTYPE;
|
|
678
|
+
readonly subtag: TTAG;
|
|
679
|
+
readonly description: string[];
|
|
680
|
+
readonly subtagRangeEnd?: TTAG;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
declare interface IRegisteredTag<TTYPE extends Model.RegistryEntryType, TTAG extends string> {
|
|
687
|
+
readonly type: TTYPE;
|
|
688
|
+
readonly tag: TTAG;
|
|
689
|
+
readonly description: string[];
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
declare interface IRegisteredVariant extends IRegisteredSubtag<'variant', VariantSubtag> {
|
|
696
|
+
readonly type: 'variant';
|
|
697
|
+
readonly subtag: VariantSubtag;
|
|
698
|
+
readonly description: string[];
|
|
699
|
+
readonly added: Model.YearMonthDaySpec;
|
|
700
|
+
readonly comments?: string[];
|
|
701
|
+
readonly deprecated?: Model.YearMonthDaySpec;
|
|
702
|
+
readonly preferredValue?: VariantSubtag;
|
|
703
|
+
readonly prefix?: ExtendedLanguageRange[];
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Represents a single variant subtag with corresponding registry data,
|
|
708
|
+
* if present.
|
|
709
|
+
* @public
|
|
710
|
+
*/
|
|
711
|
+
declare interface IRegisteredVariantValue {
|
|
712
|
+
/**
|
|
713
|
+
* A {@link Iana.LanguageSubtags.VariantSubtag | variant subtag} from
|
|
714
|
+
* the original language tag.
|
|
715
|
+
*/
|
|
716
|
+
subtag: Iana.LanguageSubtags.VariantSubtag;
|
|
717
|
+
/**
|
|
718
|
+
* The {@link Iana.LanguageSubtag.Model.RegisteredVariant | IANA subtag registry entry}
|
|
719
|
+
* for this subtag, or `undefined` if the subtag is not registered.
|
|
720
|
+
*/
|
|
721
|
+
registry?: Iana.LanguageSubtags.Model.IRegisteredVariant;
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @internal
|
|
726
|
+
*/
|
|
727
|
+
declare interface IRegistryEntryBase<TTYPE extends RegistryEntryType = RegistryEntryType> {
|
|
728
|
+
Type: TTYPE;
|
|
729
|
+
Description: string[];
|
|
730
|
+
Added: YearMonthDaySpec;
|
|
731
|
+
Deprecated?: YearMonthDaySpec;
|
|
732
|
+
'Suppress-Script'?: ScriptSubtag;
|
|
733
|
+
Macrolanguage?: LanguageSubtag;
|
|
734
|
+
'Preferred-Value'?: string;
|
|
735
|
+
Prefix?: string[];
|
|
736
|
+
Scope?: RegistryEntryScope;
|
|
737
|
+
Comments?: string[];
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* @internal
|
|
742
|
+
*/
|
|
743
|
+
declare interface IRegistrySubtagEntry<TTYPE extends RegistryEntryType = RegistryEntryType, TSUBTAG extends string = string> extends IRegistryEntryBase<TTYPE> {
|
|
744
|
+
Subtag: TSUBTAG | TSUBTAG[];
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* @internal
|
|
749
|
+
*/
|
|
750
|
+
declare interface IRegistryTagEntry<TTYPE extends RegistryEntryType = RegistryEntryType, TTAG extends string = string> extends IRegistryEntryBase<TTYPE> {
|
|
751
|
+
Tag: TTAG | TTAG[];
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Represents an ISO 3166 Alpha-2 region code.
|
|
756
|
+
* @public
|
|
757
|
+
*/
|
|
758
|
+
declare type IsoAlpha2RegionCode = Brand<string, 'IsoAlpha2RegionCode'>;
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Validating converter from string {@link Iana.Model.IsoAlpha2RegionCode}.
|
|
762
|
+
* @public
|
|
763
|
+
*/
|
|
764
|
+
declare const isoAlpha2RegionCode: Converter<IsoAlpha2RegionCode, unknown>;
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* @public
|
|
768
|
+
*/
|
|
769
|
+
declare const isoAlpha2RegionCode_2: RegExpValidationHelpers<Model_5.IsoAlpha2RegionCode, unknown>;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Represents an ISO 3166 Alpha-3 region code.
|
|
773
|
+
* @public
|
|
774
|
+
*/
|
|
775
|
+
declare type IsoAlpha3RegionCode = Brand<string, 'IsoAlpha3RegionCode'>;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Validating converter from string {@link Iana.Model.IsoAlpha3RegionCode}.
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
781
|
+
declare const isoAlpha3RegionCode: Converter<IsoAlpha3RegionCode, unknown>;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* @public
|
|
785
|
+
*/
|
|
786
|
+
declare const isoAlpha3RegionCode_2: RegExpValidationHelpers<Model_5.IsoAlpha3RegionCode, unknown>;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* @public
|
|
790
|
+
*/
|
|
791
|
+
declare interface ISubtags {
|
|
792
|
+
primaryLanguage?: Iana.LanguageSubtags.LanguageSubtag;
|
|
793
|
+
extlangs?: Iana.LanguageSubtags.ExtLangSubtag[];
|
|
794
|
+
script?: Iana.LanguageSubtags.ScriptSubtag;
|
|
795
|
+
region?: Iana.LanguageSubtags.RegionSubtag;
|
|
796
|
+
variants?: Iana.LanguageSubtags.VariantSubtag[];
|
|
797
|
+
extensions?: IExtensionSubtagValue[];
|
|
798
|
+
privateUse?: Iana.LanguageSubtags.ExtendedLanguageRange[];
|
|
799
|
+
grandfathered?: Iana.LanguageSubtags.GrandfatheredTag;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* @public
|
|
804
|
+
*/
|
|
805
|
+
declare interface ITagNormalizer {
|
|
806
|
+
readonly normalization: TagNormalization;
|
|
807
|
+
processSubtags(subtags: ISubtags): Result<ISubtags>;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* @public
|
|
812
|
+
*/
|
|
813
|
+
declare interface ITagValidator {
|
|
814
|
+
readonly validity: TagValidity;
|
|
815
|
+
validateSubtags(subtags: ISubtags): Result<true>;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
declare namespace Items {
|
|
819
|
+
export {
|
|
820
|
+
IRegisteredSubtag,
|
|
821
|
+
IRegisteredSubtagWithRange,
|
|
822
|
+
IRegisteredTag,
|
|
823
|
+
RegisteredTagOrSubtag,
|
|
824
|
+
IRegisteredLanguage,
|
|
825
|
+
IRegisteredExtLang,
|
|
826
|
+
IRegisteredScript,
|
|
827
|
+
IRegisteredRegion,
|
|
828
|
+
IRegisteredVariant,
|
|
829
|
+
IRegisteredGrandfatheredTag,
|
|
830
|
+
IRegisteredRedundantTag,
|
|
831
|
+
RegisteredSubtagItem,
|
|
832
|
+
RegisteredTagItem,
|
|
833
|
+
RegisteredItem,
|
|
834
|
+
RegistryFile_2 as RegistryFile
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Initializer for {@link Utils.ValidationHelpers | validation helpers}.
|
|
840
|
+
* @public
|
|
841
|
+
*/
|
|
842
|
+
declare interface IValidationHelpersConstructorParams<T extends string, TC = unknown> {
|
|
843
|
+
description: string;
|
|
844
|
+
isWellFormed: Validation.TypeGuardWithContext<T, TC>;
|
|
845
|
+
isCanonical: Validation.TypeGuardWithContext<T, TC>;
|
|
846
|
+
toCanonical?: Normalizer<T, TC>;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
declare namespace Jar {
|
|
850
|
+
export {
|
|
851
|
+
datedRegistryFromJarRecords,
|
|
852
|
+
fileDateEntry
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
declare namespace Jar_2 {
|
|
857
|
+
export {
|
|
858
|
+
Converters_2 as Converters,
|
|
859
|
+
LanguageSubtags_2 as LanguageSubtags,
|
|
860
|
+
Model_3 as Model
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
declare namespace Jar_3 {
|
|
865
|
+
export {
|
|
866
|
+
IFileDateEntry
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
declare namespace JarConverters {
|
|
871
|
+
export {
|
|
872
|
+
loadJsonSubtagRegistryFileSync,
|
|
873
|
+
loadTxtSubtagRegistryFileSync,
|
|
874
|
+
registeredLanguage_2 as registeredLanguage,
|
|
875
|
+
registeredExtLang_2 as registeredExtLang,
|
|
876
|
+
registeredScript_2 as registeredScript,
|
|
877
|
+
registeredRegion_2 as registeredRegion,
|
|
878
|
+
registeredVariant_2 as registeredVariant,
|
|
879
|
+
registeredGrandfatheredTag_2 as registeredGrandfatheredTag,
|
|
880
|
+
registeredRedundantTag_2 as registeredRedundantTag,
|
|
881
|
+
registeredItem_2 as registeredItem,
|
|
882
|
+
registryFile_2 as registryFile
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
declare namespace JarConverters_2 {
|
|
887
|
+
export {
|
|
888
|
+
loadJsonLanguageTagExtensionsRegistryFileSync,
|
|
889
|
+
loadTxtLanguageTagExtensionsRegistryFileSync,
|
|
890
|
+
languageTagExtension_2 as languageTagExtension,
|
|
891
|
+
languageTagExtensions_2 as languageTagExtensions
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* @public
|
|
897
|
+
*/
|
|
898
|
+
declare class LanguageRegistries {
|
|
899
|
+
readonly subtags: LanguageSubtagRegistry;
|
|
900
|
+
readonly extensions: LanguageTagExtensionRegistry;
|
|
901
|
+
private constructor();
|
|
902
|
+
static load(root: string): Result<LanguageRegistries>;
|
|
903
|
+
static loadDefault(): Result<LanguageRegistries>;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Returns all of the data in the IANA language subtags registry for
|
|
908
|
+
* a set of supplied {@link Bcp47.Subtags | subtags}.
|
|
909
|
+
* @public
|
|
910
|
+
*/
|
|
911
|
+
declare class LanguageRegistryData {
|
|
912
|
+
/**
|
|
913
|
+
* @internal
|
|
914
|
+
*/
|
|
915
|
+
protected _iana: Iana.LanguageRegistries;
|
|
916
|
+
/**
|
|
917
|
+
* @internal
|
|
918
|
+
*/
|
|
919
|
+
protected _subtags: ISubtags;
|
|
920
|
+
/**
|
|
921
|
+
* @internal
|
|
922
|
+
*/
|
|
923
|
+
protected _primaryLanguage?: Iana.LanguageSubtags.Model.IRegisteredLanguage | false;
|
|
924
|
+
/**
|
|
925
|
+
* @internal
|
|
926
|
+
*/
|
|
927
|
+
protected _extlangs?: IRegisteredExtLangValue[] | false;
|
|
928
|
+
/**
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
protected _script?: Iana.LanguageSubtags.Model.IRegisteredScript | false;
|
|
932
|
+
/**
|
|
933
|
+
* @internal
|
|
934
|
+
*/
|
|
935
|
+
protected _effectiveScript?: Iana.LanguageSubtags.Model.IRegisteredScript | false;
|
|
936
|
+
/**
|
|
937
|
+
* @internal
|
|
938
|
+
*/
|
|
939
|
+
protected _region?: Iana.LanguageSubtags.Model.IRegisteredRegion | false;
|
|
940
|
+
/**
|
|
941
|
+
* @internal
|
|
942
|
+
*/
|
|
943
|
+
protected _variants?: IRegisteredVariantValue[] | false;
|
|
944
|
+
/**
|
|
945
|
+
* @internal
|
|
946
|
+
*/
|
|
947
|
+
protected _extensions?: IRegisteredExtensionValue[] | false;
|
|
948
|
+
/**
|
|
949
|
+
* @internal
|
|
950
|
+
*/
|
|
951
|
+
protected _grandfathered?: Iana.LanguageSubtags.Model.IRegisteredGrandfatheredTag | false;
|
|
952
|
+
/**
|
|
953
|
+
* Constructs a new {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
954
|
+
* from a supplied {@link Bcp47.Subtags | subtags} and {@link Iana.LanguageRegistries | language registries}.
|
|
955
|
+
* @public
|
|
956
|
+
*/
|
|
957
|
+
constructor(subtags: ISubtags, iana: Iana.LanguageRegistries);
|
|
958
|
+
/**
|
|
959
|
+
* Registry data associated with the primary language subtag of the language tag from
|
|
960
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
961
|
+
* was constructed, or `undefined` if the primary language is missing or invalid.
|
|
962
|
+
* @public
|
|
963
|
+
*/
|
|
964
|
+
get primaryLanguage(): Iana.LanguageSubtags.Model.IRegisteredLanguage | undefined;
|
|
965
|
+
/**
|
|
966
|
+
* Registry data associated with the extlang subtag of the language tag from
|
|
967
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
968
|
+
* was constructed, or `undefined` if extlang is missing or invalid.
|
|
969
|
+
* @public
|
|
970
|
+
*/
|
|
971
|
+
get extlangs(): IRegisteredExtLangValue[] | undefined;
|
|
972
|
+
/**
|
|
973
|
+
* Registry data associated with the script of the language tag from
|
|
974
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
975
|
+
* was constructed, or `undefined` if the script cannot be determined.
|
|
976
|
+
*
|
|
977
|
+
* @public
|
|
978
|
+
*/
|
|
979
|
+
get script(): Iana.LanguageSubtags.Model.IRegisteredScript | undefined;
|
|
980
|
+
/**
|
|
981
|
+
* Registry data associated with the script of the language tag from
|
|
982
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
983
|
+
* was constructed, or `undefined` if the script cannot be determined.
|
|
984
|
+
*
|
|
985
|
+
* Note that effectiveScript will default to the registry `Suppress-Script` value of the
|
|
986
|
+
* primary language if no script subtag is present.
|
|
987
|
+
* @public
|
|
988
|
+
*/
|
|
989
|
+
get effectiveScript(): Iana.LanguageSubtags.Model.IRegisteredScript | undefined;
|
|
990
|
+
/**
|
|
991
|
+
* Registry data associated with the region subtag of the language tag from
|
|
992
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
993
|
+
* was constructed, or `undefined` if the region is missing or invalid.
|
|
994
|
+
* @public
|
|
995
|
+
*/
|
|
996
|
+
get region(): Iana.LanguageSubtags.Model.IRegisteredRegion | undefined;
|
|
997
|
+
/**
|
|
998
|
+
* Registry data associated with the variant subtags of the language tag from
|
|
999
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
1000
|
+
* was constructed, or `undefined` if variant subtags are missing or invalid.
|
|
1001
|
+
* @public
|
|
1002
|
+
*/
|
|
1003
|
+
get variants(): IRegisteredVariantValue[] | undefined;
|
|
1004
|
+
/**
|
|
1005
|
+
* Registry data associated with the extension subtags of the language tag from
|
|
1006
|
+
* which this {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
1007
|
+
* was constructed, or `undefined` if extension subtags are missing or invalid.
|
|
1008
|
+
* @public
|
|
1009
|
+
*/
|
|
1010
|
+
get extensions(): IRegisteredExtensionValue[] | undefined;
|
|
1011
|
+
/**
|
|
1012
|
+
* Registry data for grandfathered tags, or `undefined` if the tag is not recognized
|
|
1013
|
+
* as a grandfathered tag.
|
|
1014
|
+
* @public
|
|
1015
|
+
*/
|
|
1016
|
+
get grandfathered(): Iana.LanguageSubtags.Model.IRegisteredGrandfatheredTag | undefined;
|
|
1017
|
+
/**
|
|
1018
|
+
* @returns A string representation of the subtags from which this
|
|
1019
|
+
* {@link Bcp47.LanguageTagRegistryData | Bcp47.LanguageTagRegistryData}
|
|
1020
|
+
* was created.
|
|
1021
|
+
* @public
|
|
1022
|
+
*/
|
|
1023
|
+
toString(): string;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Helper to compare two language tags to determine how closely related they are,
|
|
1028
|
+
* applying normalization and language semantics as appropriate.
|
|
1029
|
+
* @public
|
|
1030
|
+
*/
|
|
1031
|
+
declare class LanguageSimilarityMatcher {
|
|
1032
|
+
iana: Iana.LanguageRegistries;
|
|
1033
|
+
unsd: Unsd.RegionCodes;
|
|
1034
|
+
overrides: OverridesRegistry;
|
|
1035
|
+
constructor(iana?: Iana.LanguageRegistries);
|
|
1036
|
+
matchLanguageTags(t1: LanguageTag, t2: LanguageTag): number;
|
|
1037
|
+
matchPrimaryLanguage(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1038
|
+
matchExtlang(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1039
|
+
matchScript(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1040
|
+
matchRegion(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1041
|
+
matchVariants(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1042
|
+
matchExtensions(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1043
|
+
matchPrivateUseTags(lt1: LanguageTag, lt2: LanguageTag): number;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Any of the possible ways to represent a language - as a `string`,
|
|
1048
|
+
* parsed {@link Bcp47.Subtags | subtags} or an instantiated
|
|
1049
|
+
* {@link Bcp47.LanguageTag | language tag}.
|
|
1050
|
+
* @public
|
|
1051
|
+
*/
|
|
1052
|
+
declare type LanguageSpec = string | ISubtags | LanguageTag;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Primary language subtag in the IANA language subtag registry.
|
|
1056
|
+
* @public
|
|
1057
|
+
*/
|
|
1058
|
+
declare type LanguageSubtag = Brand<string, 'LanguageSubtag'>;
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* @public
|
|
1062
|
+
*/
|
|
1063
|
+
declare const languageSubtag: Conversion.Converter<LanguageSubtag, unknown>;
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* @public
|
|
1067
|
+
*/
|
|
1068
|
+
declare const languageSubtag_2: RegExpValidationHelpers<LanguageSubtag, unknown>;
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* @public
|
|
1072
|
+
*/
|
|
1073
|
+
declare class LanguageSubtagRegistry {
|
|
1074
|
+
readonly fileDate: YearMonthDaySpec;
|
|
1075
|
+
readonly languages: Scope.LanguageSubtagScope;
|
|
1076
|
+
readonly extlangs: Scope.ExtLangSubtagScope;
|
|
1077
|
+
readonly scripts: Scope.ScriptSubtagScope;
|
|
1078
|
+
readonly regions: Scope.RegionSubtagScope;
|
|
1079
|
+
readonly variants: Scope.VariantSubtagScope;
|
|
1080
|
+
readonly collections: Scope.LanguageSubtagScope;
|
|
1081
|
+
readonly macrolanguages: Scope.LanguageSubtagScope;
|
|
1082
|
+
readonly privateUse: Scope.LanguageSubtagScope;
|
|
1083
|
+
readonly special: Scope.LanguageSubtagScope;
|
|
1084
|
+
readonly grandfathered: Scope.GrandfatheredTagScope;
|
|
1085
|
+
readonly redundant: Scope.RedundantTagScope;
|
|
1086
|
+
/**
|
|
1087
|
+
* @internal
|
|
1088
|
+
*/
|
|
1089
|
+
protected readonly _all: RegisteredItem[];
|
|
1090
|
+
/**
|
|
1091
|
+
* @param registry - The contents of the registry file
|
|
1092
|
+
* from which the data is loaded.
|
|
1093
|
+
* @internal
|
|
1094
|
+
*/
|
|
1095
|
+
protected constructor(registry: RegistryFile_2);
|
|
1096
|
+
static create(registry: RegistryFile_2): Result<LanguageSubtagRegistry>;
|
|
1097
|
+
static createFromJson(from: unknown): Result<LanguageSubtagRegistry>;
|
|
1098
|
+
static loadDefault(): Result<LanguageSubtagRegistry>;
|
|
1099
|
+
static load(root: string): Result<LanguageSubtagRegistry>;
|
|
1100
|
+
static loadJsonRegistryFile(root: string): Result<LanguageSubtagRegistry>;
|
|
1101
|
+
static loadTxtRegistryFile(root: string): Result<LanguageSubtagRegistry>;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* @internal
|
|
1106
|
+
*/
|
|
1107
|
+
declare type LanguageSubtagRegistryEntry = IRegistrySubtagEntry<'language', LanguageSubtag>;
|
|
1108
|
+
|
|
1109
|
+
declare namespace LanguageSubtags {
|
|
1110
|
+
export {
|
|
1111
|
+
rangeOfTags,
|
|
1112
|
+
tagOrRange,
|
|
1113
|
+
tagOrStartOfTagRange,
|
|
1114
|
+
endOfTagRangeOrUndefined,
|
|
1115
|
+
languageSubtag,
|
|
1116
|
+
extlangSubtag,
|
|
1117
|
+
scriptSubtag,
|
|
1118
|
+
regionSubtag,
|
|
1119
|
+
variantSubtag,
|
|
1120
|
+
grandfatheredTag,
|
|
1121
|
+
redundantTag,
|
|
1122
|
+
extendedLanguageRange,
|
|
1123
|
+
extlangPrefix
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
declare namespace LanguageSubtags_2 {
|
|
1128
|
+
export {
|
|
1129
|
+
Converters_3 as Converters,
|
|
1130
|
+
Tags,
|
|
1131
|
+
Model as Registry
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
declare namespace LanguageSubtags_3 {
|
|
1136
|
+
export {
|
|
1137
|
+
Model as Registry,
|
|
1138
|
+
Tags_2 as Tags
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
declare namespace LanguageSubtags_4 {
|
|
1143
|
+
export {
|
|
1144
|
+
LanguageSubtagRegistry,
|
|
1145
|
+
Converters_4 as Converters,
|
|
1146
|
+
JarConverters,
|
|
1147
|
+
Items as Model,
|
|
1148
|
+
Validate,
|
|
1149
|
+
ExtLangSubtag,
|
|
1150
|
+
ExtendedLanguageRange,
|
|
1151
|
+
GrandfatheredTag,
|
|
1152
|
+
LanguageSubtag,
|
|
1153
|
+
RedundantTag,
|
|
1154
|
+
RegionSubtag,
|
|
1155
|
+
ScriptSubtag,
|
|
1156
|
+
VariantSubtag,
|
|
1157
|
+
RegistryEntryScope,
|
|
1158
|
+
RegistryEntryType
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* @public
|
|
1164
|
+
*/
|
|
1165
|
+
declare class LanguageSubtagScope extends SubtagScopeWithRange<'language', LanguageSubtag, Items.IRegisteredLanguage> {
|
|
1166
|
+
constructor();
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Represents a single BCP-47 language tag.
|
|
1171
|
+
* @public
|
|
1172
|
+
*/
|
|
1173
|
+
declare class LanguageTag {
|
|
1174
|
+
/**
|
|
1175
|
+
* The individual {@link Bcp47.Subtags | subtags} for
|
|
1176
|
+
* this language tag.
|
|
1177
|
+
*/
|
|
1178
|
+
readonly subtags: Readonly<ISubtags>;
|
|
1179
|
+
/**
|
|
1180
|
+
* A string representation of this language tag.
|
|
1181
|
+
*/
|
|
1182
|
+
readonly tag: string;
|
|
1183
|
+
/**
|
|
1184
|
+
* Details about this language tag from the IANA language
|
|
1185
|
+
* registries.
|
|
1186
|
+
*/
|
|
1187
|
+
readonly registry: LanguageRegistryData;
|
|
1188
|
+
/**
|
|
1189
|
+
* @internal
|
|
1190
|
+
*/
|
|
1191
|
+
protected readonly _iana: Iana.LanguageRegistries;
|
|
1192
|
+
/**
|
|
1193
|
+
* @internal
|
|
1194
|
+
*/
|
|
1195
|
+
protected _validity: TagValidity;
|
|
1196
|
+
/**
|
|
1197
|
+
* @internal
|
|
1198
|
+
*/
|
|
1199
|
+
protected _normalization: TagNormalization;
|
|
1200
|
+
/**
|
|
1201
|
+
* @internal
|
|
1202
|
+
*/
|
|
1203
|
+
protected _isValid: undefined | boolean;
|
|
1204
|
+
/**
|
|
1205
|
+
* @internal
|
|
1206
|
+
*/
|
|
1207
|
+
protected _isStrictlyValid: undefined | boolean;
|
|
1208
|
+
/**
|
|
1209
|
+
* @internal
|
|
1210
|
+
*/
|
|
1211
|
+
protected _isCanonical: undefined | boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* @internal
|
|
1214
|
+
*/
|
|
1215
|
+
protected _isPreferred: undefined | boolean;
|
|
1216
|
+
/**
|
|
1217
|
+
* @internal
|
|
1218
|
+
*/
|
|
1219
|
+
protected _suppressedScript: undefined | Iana.LanguageSubtags.ScriptSubtag | false;
|
|
1220
|
+
/**
|
|
1221
|
+
* Constructs a {@link Bcp47.LanguageTag | LanguageTag }.
|
|
1222
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } from
|
|
1223
|
+
* which the tag is constructed.
|
|
1224
|
+
* @param validity - Known {@link Bcp47.TagValidity | validation level} of the
|
|
1225
|
+
* supplied subtags.
|
|
1226
|
+
* @param normalization - Known {@link Bcp47.TagNormalization | normalization level}
|
|
1227
|
+
* of the supplied subtags.
|
|
1228
|
+
* @param iana - The {@link Iana.LanguageRegistries} used to validate and normalize
|
|
1229
|
+
* this tag.
|
|
1230
|
+
* @internal
|
|
1231
|
+
*/
|
|
1232
|
+
protected constructor(subtags: ISubtags, validity: TagValidity, normalization: TagNormalization, iana: Iana.LanguageRegistries);
|
|
1233
|
+
/**
|
|
1234
|
+
* The effective script of this language tag, if known.
|
|
1235
|
+
* The effective script is the script subtag in the tag itself,
|
|
1236
|
+
* if present, or the `Suppress-Script` defined in the
|
|
1237
|
+
* {@link https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | IANA subtag registry}
|
|
1238
|
+
* for the primary language of this tag. Can be `undefined`
|
|
1239
|
+
* if neither the tag nor the IANA registry define a script.
|
|
1240
|
+
*/
|
|
1241
|
+
get effectiveScript(): Iana.LanguageSubtags.ScriptSubtag | undefined;
|
|
1242
|
+
/**
|
|
1243
|
+
* Determines if this tag represents the special `undetermined` language.
|
|
1244
|
+
*/
|
|
1245
|
+
get isUndetermined(): boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Whether this language tag is valid.
|
|
1248
|
+
*/
|
|
1249
|
+
get isValid(): boolean;
|
|
1250
|
+
/**
|
|
1251
|
+
* Whether if this language tag is strictly valid.
|
|
1252
|
+
*/
|
|
1253
|
+
get isStrictlyValid(): boolean;
|
|
1254
|
+
/**
|
|
1255
|
+
* Whether this language tag is in canonical form.
|
|
1256
|
+
*/
|
|
1257
|
+
get isCanonical(): boolean;
|
|
1258
|
+
/**
|
|
1259
|
+
* Whether this language tag is in preferred form.
|
|
1260
|
+
*/
|
|
1261
|
+
get isPreferred(): boolean;
|
|
1262
|
+
/**
|
|
1263
|
+
* Whether this language tag is a grandfathered tag.
|
|
1264
|
+
*/
|
|
1265
|
+
get isGrandfathered(): boolean;
|
|
1266
|
+
/**
|
|
1267
|
+
* Gets a text description of this tag.
|
|
1268
|
+
*/
|
|
1269
|
+
get description(): string;
|
|
1270
|
+
/**
|
|
1271
|
+
* Creates a new {@link Bcp47.LanguageTag | language tag} from a supplied `string` tag
|
|
1272
|
+
* using optional configuration, if supplied.
|
|
1273
|
+
* @param tag - The `string` tag from which the {@link Bcp47.LanguageTag | language tag}
|
|
1274
|
+
* is te be constructed.
|
|
1275
|
+
* @param options - (optional) set of {@link Bcp47.LanguageTagInitOptions | init options}
|
|
1276
|
+
* to guide the validation and normalization of this tag.
|
|
1277
|
+
* @returns `Success` with the new {@link Bcp47.LanguageTag | language tag} or `Failure`
|
|
1278
|
+
* with details if an error occurs.
|
|
1279
|
+
*/
|
|
1280
|
+
static createFromTag(tag: string, options?: ILanguageTagInitOptions): Result<LanguageTag>;
|
|
1281
|
+
/**
|
|
1282
|
+
* Creates a new {@link Bcp47.LanguageTag | language tag} from a supplied
|
|
1283
|
+
* {@link Bcp47.Subtags | subtags} using optional configuration,
|
|
1284
|
+
* if supplied.
|
|
1285
|
+
* @param tag - The {@link Bcp47.Subtags | subtags} from which the
|
|
1286
|
+
* {@link Bcp47.LanguageTag | language tag} is te be constructed.
|
|
1287
|
+
* @param options - (optional) set of {@link Bcp47.LanguageTagInitOptions | init options}
|
|
1288
|
+
* to guide the validation and normalization of this tag.
|
|
1289
|
+
* @returns `Success` with the new {@link Bcp47.LanguageTag | language tag} or `Failure`
|
|
1290
|
+
* with details if an error occurs.
|
|
1291
|
+
*/
|
|
1292
|
+
static createFromSubtags(subtags: ISubtags, options?: ILanguageTagInitOptions): Result<LanguageTag>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Creates a new {@link Bcp47.LanguageTag | language tag} from a supplied `string`
|
|
1295
|
+
* tag or {@link Bcp47.Subtags | subtags} using optional configuration,
|
|
1296
|
+
* if supplied.
|
|
1297
|
+
* @param from - The `string` tag or {@link Bcp47.Subtags | subtags} from
|
|
1298
|
+
* which the {@link Bcp47.LanguageTag | language tag} is te be constructed.
|
|
1299
|
+
* @param options - (optional) set of {@link Bcp47.LanguageTagInitOptions | init options}
|
|
1300
|
+
* to guide the validation and normalization of this tag.
|
|
1301
|
+
* @returns `Success` with the new {@link Bcp47.LanguageTag | language tag} or `Failure`
|
|
1302
|
+
* with details if an error occurs.
|
|
1303
|
+
*/
|
|
1304
|
+
static create(from: string | ISubtags, options?: ILanguageTagInitOptions): Result<LanguageTag>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Constructs a new {@link Bcp47.LanguageTag | language tag} by applying appropriate transformations
|
|
1307
|
+
* to as supplied {@link Bcp47.Subtags | Bcp47.Subtags}.
|
|
1308
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags} which represent the tag.
|
|
1309
|
+
* @param fromValidity - The {@link Bcp47.TagValidity | validation level} of the supplied subtags.
|
|
1310
|
+
* @param fromNormalization - The {@link Bcp47.TagNormalization | normalization level} fo the
|
|
1311
|
+
* supplied subtags.
|
|
1312
|
+
* @param partialOptions - Any {@link Bcp47.LanguageTagInitOptions | initialization options}.
|
|
1313
|
+
* @returns `Success` with the corresponding {@link Bcp47.LanguageTag | language tag} or `Failure`
|
|
1314
|
+
* with details if an error occurs.
|
|
1315
|
+
* @internal
|
|
1316
|
+
*/
|
|
1317
|
+
protected static _createTransformed(subtags: ISubtags, fromValidity: TagValidity, fromNormalization: TagNormalization, partialOptions?: ILanguageTagInitOptions): Result<LanguageTag>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Gets a fully-specified {@link Bcp47.LanguageTagInitOptions} from partial or undefined
|
|
1320
|
+
* options, substituting defaults as appropriate.
|
|
1321
|
+
* @param options - The {@link Bcp47.LanguageTagInitOptions} to be expanded, or `undefined`
|
|
1322
|
+
* for default options.
|
|
1323
|
+
* @returns Fully-specified {@link Bcp47.LanguageTagInitOptions | init options}.
|
|
1324
|
+
* @internal
|
|
1325
|
+
*/
|
|
1326
|
+
protected static _getOptions(options?: ILanguageTagInitOptions): Required<ILanguageTagInitOptions>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Returns the `Suppress-Script` value defined for the primary language of this tag,
|
|
1329
|
+
* regardless of whether a different script is defined in this subtag.
|
|
1330
|
+
* @returns The suppress-script defined for the primary language, or undefined if
|
|
1331
|
+
* the primary language is invalid or has no defined suppressed script.
|
|
1332
|
+
*/
|
|
1333
|
+
getSuppressedScript(): Iana.LanguageSubtags.ScriptSubtag | undefined;
|
|
1334
|
+
/**
|
|
1335
|
+
* Gets a confirmed valid representation of this language tag.
|
|
1336
|
+
* @returns `Success` with a valid representation of this {@link Bcp47.LanguageTag | language tag},
|
|
1337
|
+
* or `Failure` with details if the tag cannot be validated.
|
|
1338
|
+
*/
|
|
1339
|
+
toValid(): Result<LanguageTag>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Gets a confirmed strictly valid representation of this language tag.
|
|
1342
|
+
* @returns `Success` with a strictly valid representation of this {@link Bcp47.LanguageTag | language tag},
|
|
1343
|
+
* or `Failure` with details if the tag cannot be strictly validated.
|
|
1344
|
+
*/
|
|
1345
|
+
toStrictlyValid(): Result<LanguageTag>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Gets a confirmed canonical representation of this language tag.
|
|
1348
|
+
* @returns `Success` with a canonical representation of this {@link Bcp47.LanguageTag | language tag},
|
|
1349
|
+
* or `Failure` with details if the tag cannot be normalized to canonical form.
|
|
1350
|
+
*/
|
|
1351
|
+
toCanonical(): Result<LanguageTag>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Gets a confirmed preferred representation of this language tag.
|
|
1354
|
+
* @returns `Success` with a preferred representation of this {@link Bcp47.LanguageTag | language tag},
|
|
1355
|
+
* or `Failure` with details if the tag cannot be normalized to preferred form.
|
|
1356
|
+
*/
|
|
1357
|
+
toPreferred(): Result<LanguageTag>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Gets a string representation of this language tag.
|
|
1360
|
+
* @returns A string representation of this language tag.
|
|
1361
|
+
*/
|
|
1362
|
+
toString(): string;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* @internal
|
|
1367
|
+
*/
|
|
1368
|
+
declare const languageTagExtension: Converter<Model_2.ILanguageTagExtension, unknown>;
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* @internal
|
|
1372
|
+
*/
|
|
1373
|
+
declare const languageTagExtension_2: Converter<Model_2.ILanguageTagExtension, unknown>;
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* @public
|
|
1377
|
+
*/
|
|
1378
|
+
declare class LanguageTagExtensionRegistry {
|
|
1379
|
+
readonly fileDate: YearMonthDaySpec_2;
|
|
1380
|
+
readonly extensions: TagExtensionsScope;
|
|
1381
|
+
/**
|
|
1382
|
+
* @internal
|
|
1383
|
+
*/
|
|
1384
|
+
protected readonly _all: Model_2.ILanguageTagExtension[];
|
|
1385
|
+
/**
|
|
1386
|
+
* Constructs an {@link Iana.LanguageTagExtensions.LanguageTagExtensionRegistry}.
|
|
1387
|
+
* @param registry - Registry file from which the registry is to be constructed.
|
|
1388
|
+
* @internal
|
|
1389
|
+
*/
|
|
1390
|
+
protected constructor(registry: Model_2.LanguageTagExtensions);
|
|
1391
|
+
static create(registry: Model_2.LanguageTagExtensions): Result<LanguageTagExtensionRegistry>;
|
|
1392
|
+
static createFromJson(from: unknown): Result<LanguageTagExtensionRegistry>;
|
|
1393
|
+
static loadDefault(): Result<LanguageTagExtensionRegistry>;
|
|
1394
|
+
static load(path: string): Result<LanguageTagExtensionRegistry>;
|
|
1395
|
+
static loadJsonRegistryFile(path: string): Result<LanguageTagExtensionRegistry>;
|
|
1396
|
+
static loadTxtRegistryFile(path: string): Result<LanguageTagExtensionRegistry>;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* @internal
|
|
1401
|
+
*/
|
|
1402
|
+
declare interface LanguageTagExtensionRegistryEntry {
|
|
1403
|
+
Identifier: ExtensionSingleton_2;
|
|
1404
|
+
Description: string[];
|
|
1405
|
+
Comments: string[];
|
|
1406
|
+
Added: YearMonthDaySpec_2;
|
|
1407
|
+
RFC: string;
|
|
1408
|
+
Authority: string;
|
|
1409
|
+
Contact_Email: string;
|
|
1410
|
+
Mailing_List: string;
|
|
1411
|
+
URL: string;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* @internal
|
|
1416
|
+
*/
|
|
1417
|
+
declare type LanguageTagExtensions = IDatedRegistry<ILanguageTagExtension>;
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* @internal
|
|
1421
|
+
*/
|
|
1422
|
+
declare const languageTagExtensions: Converter<IDatedRegistry<Model_2.ILanguageTagExtension>, unknown>;
|
|
1423
|
+
|
|
1424
|
+
declare namespace LanguageTagExtensions_2 {
|
|
1425
|
+
export {
|
|
1426
|
+
LanguageTagExtensionRegistry,
|
|
1427
|
+
Converters_5 as Converters,
|
|
1428
|
+
JarConverters_2 as JarConverters,
|
|
1429
|
+
Model_2 as Model,
|
|
1430
|
+
Validate_2 as Validate
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* @internal
|
|
1436
|
+
*/
|
|
1437
|
+
declare const languageTagExtensions_2: Converter<IDatedRegistry<Model_2.ILanguageTagExtension>, unknown>;
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Loads language tag extensions registry data from a JSON-formatted file.
|
|
1441
|
+
* @param path - String path from which registry data is to be read.
|
|
1442
|
+
* @returns `Success` with the loaded language tag extension data
|
|
1443
|
+
* or `Failure` with details if an error occurs.
|
|
1444
|
+
* @internal
|
|
1445
|
+
*/
|
|
1446
|
+
declare function loadJsonLanguageTagExtensionsRegistryFileSync(path: string): Result<Model_2.LanguageTagExtensions>;
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* Loads a JSON-format language subtag registry file.
|
|
1450
|
+
* @param path - The string path from which the registry is to be loaded.
|
|
1451
|
+
* @returns `Success` with the resulting {@link Iana.LanguageSubtags.Model.RegistryFile | registry file}
|
|
1452
|
+
* or `Failure` with details if an error occurs.
|
|
1453
|
+
* @internal
|
|
1454
|
+
*/
|
|
1455
|
+
declare function loadJsonSubtagRegistryFileSync(path: string): Result<Items.RegistryFile>;
|
|
1456
|
+
|
|
1457
|
+
/**
|
|
1458
|
+
* @public
|
|
1459
|
+
* @param path - String path from which file is to be loaded.
|
|
1460
|
+
* @returns `Success` with the resulting {@link Iana.LanguageSubtags.Model.RegistryFile | registry file}
|
|
1461
|
+
* or `Failure` with details if an error occurs.
|
|
1462
|
+
*/
|
|
1463
|
+
declare function loadLanguageSubtagsJsonFileSync(path: string): Result<Items.RegistryFile>;
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* @internal
|
|
1467
|
+
* @param path - path from which the extensions registry is to be loaded.
|
|
1468
|
+
* @returns `Success` with the loaded language tag extensions data, o
|
|
1469
|
+
* or `Failure` with details if an error occurs.
|
|
1470
|
+
*/
|
|
1471
|
+
declare function loadLanguageTagExtensionsJsonFileSync(path: string): Result<Model_2.LanguageTagExtensions>;
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Loads a UNSD M.49 registry text (csv) file.
|
|
1475
|
+
* @param csvPath - The path from which the file is to be loaded.
|
|
1476
|
+
* @returns `Success` with the parsed file contents or `Failure` with
|
|
1477
|
+
* details if an error occurs.
|
|
1478
|
+
* @internal
|
|
1479
|
+
*/
|
|
1480
|
+
declare function loadM49csvFileSync(csvPath: string): Result<Model_6.IM49CsvRow[]>;
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Loads language tag extensions registry data from a text (JAR-formatted) file.
|
|
1484
|
+
* @param path - String path from which registry data is to be read.
|
|
1485
|
+
* @returns `Success` with the loaded language tag extension data
|
|
1486
|
+
* or `Failure` with details if an error occurs.
|
|
1487
|
+
* @internal
|
|
1488
|
+
*/
|
|
1489
|
+
declare function loadTxtLanguageTagExtensionsRegistryFileSync(path: string): Result<Model_2.LanguageTagExtensions>;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Loads a text (JAR) format language subtag registry file.
|
|
1493
|
+
* @param path - The string path from which the registry is to be loaded.
|
|
1494
|
+
* @returns `Success` with the resulting {@link Iana.LanguageSubtags.Model.RegistryFile | registry file}
|
|
1495
|
+
* or `Failure` with details if an error occurs.
|
|
1496
|
+
* @internal
|
|
1497
|
+
*/
|
|
1498
|
+
declare function loadTxtSubtagRegistryFileSync(path: string): Result<Items.RegistryFile>;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* @internal
|
|
1502
|
+
*/
|
|
1503
|
+
declare const m49CsvFile: Converter<Model_6.IM49CsvRow[], unknown>;
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* @internal
|
|
1507
|
+
*/
|
|
1508
|
+
declare const m49CsvRow: Converter<Model_6.IM49CsvRow, unknown>;
|
|
1509
|
+
|
|
1510
|
+
declare namespace Model {
|
|
1511
|
+
export {
|
|
1512
|
+
RegistryEntryType,
|
|
1513
|
+
allRegistryEntryTypes,
|
|
1514
|
+
RegistryEntryScope,
|
|
1515
|
+
allRegistryEntryScopes,
|
|
1516
|
+
YearMonthDaySpec,
|
|
1517
|
+
IRegistrySubtagEntry,
|
|
1518
|
+
IRegistryTagEntry,
|
|
1519
|
+
LanguageSubtagRegistryEntry,
|
|
1520
|
+
ExtLangSubtagRegistryEntry,
|
|
1521
|
+
ScriptSubtagRegistryEntry,
|
|
1522
|
+
RegionSubtagRegistryEntry,
|
|
1523
|
+
VariantSubtagRegistryEntry,
|
|
1524
|
+
GrandfatheredTagRegistryEntry,
|
|
1525
|
+
RedundantTagRegistryEntry,
|
|
1526
|
+
RegistryEntry,
|
|
1527
|
+
RegistryFile
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
declare namespace Model_2 {
|
|
1532
|
+
export {
|
|
1533
|
+
ExtensionSingleton_2 as ExtensionSingleton,
|
|
1534
|
+
LanguageTagExtensionRegistryEntry,
|
|
1535
|
+
ILanguageTagExtension,
|
|
1536
|
+
LanguageTagExtensions
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
declare namespace Model_3 {
|
|
1541
|
+
export {
|
|
1542
|
+
LanguageSubtags_3 as LanguageSubtags,
|
|
1543
|
+
IFileDateEntry
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
declare namespace Model_4 {
|
|
1548
|
+
export {
|
|
1549
|
+
Jar_3 as Jar,
|
|
1550
|
+
IsoAlpha2RegionCode,
|
|
1551
|
+
IsoAlpha3RegionCode,
|
|
1552
|
+
UnM49RegionCode,
|
|
1553
|
+
YearMonthDaySpec_2 as YearMonthDaySpec,
|
|
1554
|
+
IDatedRegistry
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
declare namespace Model_5 {
|
|
1559
|
+
export {
|
|
1560
|
+
IsoAlpha2RegionCode,
|
|
1561
|
+
IsoAlpha3RegionCode,
|
|
1562
|
+
UnM49RegionCode,
|
|
1563
|
+
YearMonthDaySpec_2 as YearMonthDaySpec,
|
|
1564
|
+
IDatedRegistry
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
declare namespace Model_6 {
|
|
1569
|
+
export {
|
|
1570
|
+
IM49CsvRow
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
declare namespace Model_7 {
|
|
1575
|
+
export {
|
|
1576
|
+
ILanguageOverrideRecord
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
declare namespace Model_8 {
|
|
1581
|
+
export {
|
|
1582
|
+
ExtensionSubtag,
|
|
1583
|
+
PrivateUseSubtag,
|
|
1584
|
+
PrivateUsePrefix,
|
|
1585
|
+
ExtensionSingleton
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* A function which accepts a value of the expected type and reformats it to match
|
|
1591
|
+
* the canonical presentation form.
|
|
1592
|
+
* @public
|
|
1593
|
+
*/
|
|
1594
|
+
declare type Normalizer<T extends string, TC = unknown> = (val: T, context?: TC) => Result<T>;
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* Normalization helpers for BCP-47 language tags.
|
|
1598
|
+
* @public
|
|
1599
|
+
*/
|
|
1600
|
+
declare class NormalizeTag {
|
|
1601
|
+
/**
|
|
1602
|
+
* @internal
|
|
1603
|
+
*/
|
|
1604
|
+
private static _normalizers;
|
|
1605
|
+
/**
|
|
1606
|
+
* Converts a BCP-47 language tag to canonical form. Canonical form uses the recommended capitalization rules
|
|
1607
|
+
* specified in {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1.1 | RFC 5646} but are not
|
|
1608
|
+
* otherwise modified.
|
|
1609
|
+
*
|
|
1610
|
+
* @param subtags - The individual {@link Bcp47.Subtags | subtags} to be normalized.
|
|
1611
|
+
* @returns `Success` with the normalized equivalent {@link Bcp47.Subtags | subtags},
|
|
1612
|
+
* or `Failure` with details if an error occurs.
|
|
1613
|
+
*/
|
|
1614
|
+
static toCanonical(subtags: ISubtags): Result<ISubtags>;
|
|
1615
|
+
/**
|
|
1616
|
+
* Converts a BCP-47 language tag to preferred form. Preferred form uses the recommended capitalization rules
|
|
1617
|
+
* specified in {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1.1 | RFC 5646} and also
|
|
1618
|
+
* applies additional preferred values specified in the
|
|
1619
|
+
* {@link https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | language subtag registry}:
|
|
1620
|
+
* extraneous (suppressed) script tags are removed, deprecated language, extlang, script or region tags are replaced
|
|
1621
|
+
* with up-to-date preferred values, and grandfathered or redundant tags with a defined preferred-value are replaced
|
|
1622
|
+
* in their entirety with the new preferred value.
|
|
1623
|
+
* @param subtags - The individual {@link Bcp47.Subtags | subtags} to be normalized.
|
|
1624
|
+
* @returns `Success` with the normalized equivalent {@link Bcp47.Subtags | subtags},
|
|
1625
|
+
* or `Failure` with details if an error occurs.
|
|
1626
|
+
*/
|
|
1627
|
+
static toPreferred(subtags: ISubtags): Result<ISubtags>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Chooses an appropriate default tag normalizer given desired and optional current
|
|
1630
|
+
* {@link Bcp47.TagNormalization | normalization level}.
|
|
1631
|
+
* @param wantNormalization - The desired {@link Bcp47.TagNormalization | normalization level}.
|
|
1632
|
+
* @param haveNormalization - (optional) The current {@link Bcp47.TagNormalization | normalization level}.
|
|
1633
|
+
* @returns An appropriate {@link Bcp47.TagNormalizer | tag normalizer} or `undefined` if no additional
|
|
1634
|
+
* normalization is necessary.
|
|
1635
|
+
* @internal
|
|
1636
|
+
*/
|
|
1637
|
+
static chooseNormalizer(wantNormalization: TagNormalization, haveNormalization?: TagNormalization): ITagNormalizer | undefined;
|
|
1638
|
+
/**
|
|
1639
|
+
* Normalizes supplied {@link Bcp47.Subtags | subtags} to a requested
|
|
1640
|
+
* {@link Bcp47.TagNormalization | normalization level}, if necessary. If
|
|
1641
|
+
* no normalization is necessary, returns the supplied subtags.
|
|
1642
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags} to be normalized.
|
|
1643
|
+
* @param wantNormalization - The desired {@link Bcp47.TagNormalization | normalization level}.
|
|
1644
|
+
* @param haveNormalization - (optional) The current {@link Bcp47.TagNormalization | normalization level}.
|
|
1645
|
+
* @returns `Success` with the normalized {@link Bcp47.Subtags | subtags}, or
|
|
1646
|
+
* `Failure` with details if an error occurs.
|
|
1647
|
+
*/
|
|
1648
|
+
static normalizeSubtags(subtags: ISubtags, wantNormalization: TagNormalization, haveNormalization?: TagNormalization): Result<ISubtags>;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
/**
|
|
1652
|
+
* Gets the current date as an {@link Iana.YearMonthDaySpec}.
|
|
1653
|
+
* @public
|
|
1654
|
+
*/
|
|
1655
|
+
declare function nowAsYearMonthDay(): YearMonthDaySpec_2;
|
|
1656
|
+
|
|
1657
|
+
declare namespace Overrides {
|
|
1658
|
+
export {
|
|
1659
|
+
OverridesRegistry,
|
|
1660
|
+
DefaultRegistries_3 as DefaultRegistries
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* @public
|
|
1666
|
+
*/
|
|
1667
|
+
declare class OverridesRegistry {
|
|
1668
|
+
readonly overrides: Map<Iana.LanguageSubtags.LanguageSubtag, ILanguageOverride>;
|
|
1669
|
+
protected constructor();
|
|
1670
|
+
static create(overrides: ILanguageOverride[]): Result<OverridesRegistry>;
|
|
1671
|
+
static createFromJson(from: unknown): Result<OverridesRegistry>;
|
|
1672
|
+
static loadDefault(): Result<OverridesRegistry>;
|
|
1673
|
+
static loadJson(path: string): Result<OverridesRegistry>;
|
|
1674
|
+
/**
|
|
1675
|
+
* Converts a file {@link Bcp47.Overrides.Model.LanguageOverrideRecord | LanguageOverrideRecord }
|
|
1676
|
+
* to a runtime {@link Bcp47.Overrides.LanguageOverride | LanguageOverride}.
|
|
1677
|
+
* @param record - The {@link Bcp47.Overrides.Model.LanguageOverrideRecord | LanguageOverrideRecord } to
|
|
1678
|
+
* be converted.
|
|
1679
|
+
* @returns `Success` with the resulting {@link Bcp47.Overrides.LanguageOverride | LanguageOverride}
|
|
1680
|
+
* or `Error` with details if an error occurs.
|
|
1681
|
+
* @internal
|
|
1682
|
+
*/
|
|
1683
|
+
protected static _overrideFromRecord(record: Model_7.ILanguageOverrideRecord): Result<ILanguageOverride>;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* @internal
|
|
1688
|
+
*/
|
|
1689
|
+
declare type PrivateUsePrefix = Brand<string, 'PrivateUsePrefix'>;
|
|
1690
|
+
|
|
1691
|
+
/**
|
|
1692
|
+
* @internal
|
|
1693
|
+
*/
|
|
1694
|
+
declare const privateUsePrefix: Converter<PrivateUsePrefix, unknown>;
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* @public
|
|
1698
|
+
*/
|
|
1699
|
+
declare const privateUsePrefix_2: RegExpValidationHelpers<Model_8.PrivateUsePrefix, unknown>;
|
|
1700
|
+
|
|
1701
|
+
/**
|
|
1702
|
+
* @internal
|
|
1703
|
+
*/
|
|
1704
|
+
declare type PrivateUseSubtag = Brand<string, 'PrivateUseSubtag'>;
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* @internal
|
|
1708
|
+
*/
|
|
1709
|
+
declare function rangeOfTags<TTAG extends string>(tagConverter: Converter<TTAG>): Converter<TTAG[]>;
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* Legacy language tag registered as redundant in the IANA language subtag registry.
|
|
1713
|
+
* @public
|
|
1714
|
+
*/
|
|
1715
|
+
declare type RedundantTag = Brand<string, 'RedundantTag'>;
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* @public
|
|
1719
|
+
*/
|
|
1720
|
+
declare const redundantTag: Conversion.Converter<RedundantTag, unknown>;
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* @public
|
|
1724
|
+
*/
|
|
1725
|
+
declare const redundantTag_2: TagValidationHelpers<RedundantTag, unknown>;
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* @internal
|
|
1729
|
+
*/
|
|
1730
|
+
declare type RedundantTagRegistryEntry = IRegistryTagEntry<'redundant', RedundantTag>;
|
|
1731
|
+
|
|
1732
|
+
/**
|
|
1733
|
+
* @public
|
|
1734
|
+
*/
|
|
1735
|
+
declare class RedundantTagScope extends TagScope<'redundant', RedundantTag, Items.IRegisteredRedundantTag> {
|
|
1736
|
+
constructor();
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
/**
|
|
1740
|
+
* @internal
|
|
1741
|
+
*/
|
|
1742
|
+
declare class RegExpValidationHelpers<T extends string, TC = unknown> extends ValidationHelpers<T, TC> {
|
|
1743
|
+
readonly wellFormed: RegExp;
|
|
1744
|
+
readonly canonical: RegExp;
|
|
1745
|
+
constructor(params: IRegExpValidationHelperConstructorParams<T, TC>);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* @public
|
|
1750
|
+
*/
|
|
1751
|
+
declare type Region = IGlobalRegion | IIntermediateRegion;
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* @public
|
|
1755
|
+
*/
|
|
1756
|
+
declare class RegionCodes {
|
|
1757
|
+
readonly regions: Regions;
|
|
1758
|
+
readonly areas: Areas;
|
|
1759
|
+
/**
|
|
1760
|
+
* @internal
|
|
1761
|
+
*/
|
|
1762
|
+
protected constructor();
|
|
1763
|
+
static create(rows: Model_6.IM49CsvRow[]): Result<RegionCodes>;
|
|
1764
|
+
static createFromJson(from: unknown): Result<RegionCodes>;
|
|
1765
|
+
static loadDefault(): Result<RegionCodes>;
|
|
1766
|
+
static loadCsv(path: string): Result<RegionCodes>;
|
|
1767
|
+
tryGetRegionOrArea(code: Iana.Model.UnM49RegionCode): Region | ICountryOrArea | undefined;
|
|
1768
|
+
getIsContained(container: Region, contained: ICountryOrArea | Region): boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* Imports a single parsed row of UN M.49 region code data
|
|
1771
|
+
* @param row - The parsed row to be imported.
|
|
1772
|
+
* @returns `Success` with `true` if the row was successfully
|
|
1773
|
+
* imported, or `Failure` with details if an error occurs.
|
|
1774
|
+
* @internal
|
|
1775
|
+
*/
|
|
1776
|
+
protected _importRow(row: Model_6.IM49CsvRow): Result<true>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Imports multiple parsed rows from UN M.49 region code data
|
|
1779
|
+
* @param rows - The parsed rows to be imported.
|
|
1780
|
+
* @returns `Success` with `true` if the rows were successfully
|
|
1781
|
+
* imported, or `Failure` with details if an error occurs.
|
|
1782
|
+
* @internal
|
|
1783
|
+
*/
|
|
1784
|
+
protected _importRows(rows: Model_6.IM49CsvRow[]): Result<true>;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
/**
|
|
1788
|
+
* @public
|
|
1789
|
+
*/
|
|
1790
|
+
declare class Regions {
|
|
1791
|
+
readonly global: IGlobalRegion;
|
|
1792
|
+
/**
|
|
1793
|
+
* @internal
|
|
1794
|
+
*/
|
|
1795
|
+
protected readonly _regions: Map<Iana.Model.UnM49RegionCode, Region>;
|
|
1796
|
+
constructor();
|
|
1797
|
+
tryGetRegion(from: Iana.Model.UnM49RegionCode): Region | undefined;
|
|
1798
|
+
getRegion(from: Iana.Model.UnM49RegionCode): Result<Region>;
|
|
1799
|
+
getOrAddRegionChildRegion(tier: IntermediateRegionTier, parent: Region, code: Iana.Model.UnM49RegionCode | undefined, name: string | undefined): Result<Region>;
|
|
1800
|
+
getAll(): Region[];
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* Region subtag in the IANA language subtag registry.
|
|
1805
|
+
* @public
|
|
1806
|
+
*/
|
|
1807
|
+
declare type RegionSubtag = Brand<string, 'RegionSubtag'>;
|
|
1808
|
+
|
|
1809
|
+
/**
|
|
1810
|
+
* @public
|
|
1811
|
+
*/
|
|
1812
|
+
declare const regionSubtag: Conversion.Converter<RegionSubtag, unknown>;
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* @public
|
|
1816
|
+
*/
|
|
1817
|
+
declare const regionSubtag_2: RegExpValidationHelpers<RegionSubtag, unknown>;
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* @internal
|
|
1821
|
+
*/
|
|
1822
|
+
declare type RegionSubtagRegistryEntry = IRegistrySubtagEntry<'region', RegionSubtag>;
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* @public
|
|
1826
|
+
*/
|
|
1827
|
+
declare class RegionSubtagScope extends SubtagScopeWithRange<'region', RegionSubtag, Items.IRegisteredRegion> {
|
|
1828
|
+
constructor();
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* @public
|
|
1833
|
+
*/
|
|
1834
|
+
declare type RegionTier = 'global' | IntermediateRegionTier;
|
|
1835
|
+
|
|
1836
|
+
/**
|
|
1837
|
+
* @internal
|
|
1838
|
+
*/
|
|
1839
|
+
declare const regionTier: Converter<RegionTier, RegionTier[]>;
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* @internal
|
|
1843
|
+
*/
|
|
1844
|
+
declare const registeredExtLang: Converter<Items.IRegisteredExtLang, unknown>;
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* @internal
|
|
1848
|
+
*/
|
|
1849
|
+
declare const registeredExtLang_2: Converter<Items.IRegisteredExtLang, unknown>;
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* @internal
|
|
1853
|
+
*/
|
|
1854
|
+
declare const registeredGrandfatheredTag: Converter<Items.IRegisteredGrandfatheredTag, unknown>;
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* @internal
|
|
1858
|
+
*/
|
|
1859
|
+
declare const registeredGrandfatheredTag_2: Converter<Items.IRegisteredGrandfatheredTag, unknown>;
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* @public
|
|
1863
|
+
*/
|
|
1864
|
+
declare type RegisteredItem = RegisteredSubtagItem | RegisteredTagItem;
|
|
1865
|
+
|
|
1866
|
+
/**
|
|
1867
|
+
* @internal
|
|
1868
|
+
*/
|
|
1869
|
+
declare const registeredItem: Converter<Items.RegisteredItem, unknown>;
|
|
1870
|
+
|
|
1871
|
+
/**
|
|
1872
|
+
* @internal
|
|
1873
|
+
*/
|
|
1874
|
+
declare const registeredItem_2: Converter<Items.RegisteredItem, unknown>;
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* @internal
|
|
1878
|
+
*/
|
|
1879
|
+
declare abstract class RegisteredItemScope<TTYPE extends string, TKEY extends string, TITEM> {
|
|
1880
|
+
protected readonly _items: Map<TKEY, TITEM>;
|
|
1881
|
+
protected readonly _type: TTYPE;
|
|
1882
|
+
protected readonly _validate: ValidationHelpers<TKEY>;
|
|
1883
|
+
protected constructor(type: TTYPE, validate: ValidationHelpers<TKEY>);
|
|
1884
|
+
getAllKeys(): TKEY[];
|
|
1885
|
+
getAll(): TITEM[];
|
|
1886
|
+
tryGet(want: string | undefined): TITEM | undefined;
|
|
1887
|
+
tryGetCanonical(want: string | undefined): TITEM | undefined;
|
|
1888
|
+
get(want: string | undefined): Result<TITEM>;
|
|
1889
|
+
getCanonical(want: string | undefined): Result<TITEM | undefined>;
|
|
1890
|
+
isWellFormed(val: unknown): val is TKEY;
|
|
1891
|
+
isCanonical(val: unknown): val is TKEY;
|
|
1892
|
+
toCanonical(val: unknown): Result<TKEY>;
|
|
1893
|
+
toValidCanonical(val: unknown): Result<TKEY>;
|
|
1894
|
+
isValid(val: unknown): val is TKEY;
|
|
1895
|
+
isValidCanonical(val: unknown): val is TKEY;
|
|
1896
|
+
verifyIsWellFormed(val: unknown): Result<TKEY>;
|
|
1897
|
+
verifyIsValid(val: unknown): Result<TKEY>;
|
|
1898
|
+
verifyIsCanonical(val: unknown): Result<TKEY>;
|
|
1899
|
+
protected _validateKey(key: TKEY): Result<true>;
|
|
1900
|
+
abstract add(entry: TITEM): Result<true>;
|
|
1901
|
+
protected abstract _validateEntry(entry: TITEM): Result<true>;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
/**
|
|
1905
|
+
* @internal
|
|
1906
|
+
*/
|
|
1907
|
+
declare const registeredLanguage: Converter<Items.IRegisteredLanguage, unknown>;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* @internal
|
|
1911
|
+
*/
|
|
1912
|
+
declare const registeredLanguage_2: Converter<Items.IRegisteredLanguage, unknown>;
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* @internal
|
|
1916
|
+
*/
|
|
1917
|
+
declare const registeredRedundantTag: Converter<Items.IRegisteredRedundantTag, unknown>;
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* @internal
|
|
1921
|
+
*/
|
|
1922
|
+
declare const registeredRedundantTag_2: Converter<Items.IRegisteredRedundantTag, unknown>;
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* @internal
|
|
1926
|
+
*/
|
|
1927
|
+
declare const registeredRegion: Converter<Items.IRegisteredRegion, unknown>;
|
|
1928
|
+
|
|
1929
|
+
/**
|
|
1930
|
+
* @internal
|
|
1931
|
+
*/
|
|
1932
|
+
declare const registeredRegion_2: Converter<Items.IRegisteredRegion, unknown>;
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* @internal
|
|
1936
|
+
*/
|
|
1937
|
+
declare const registeredScript: Converter<Items.IRegisteredScript, unknown>;
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* @internal
|
|
1941
|
+
*/
|
|
1942
|
+
declare const registeredScript_2: Converter<Items.IRegisteredScript, unknown>;
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* @public
|
|
1946
|
+
*/
|
|
1947
|
+
declare type RegisteredSubtagItem = IRegisteredLanguage | IRegisteredExtLang | IRegisteredScript | IRegisteredRegion | IRegisteredVariant;
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* @public
|
|
1951
|
+
*/
|
|
1952
|
+
declare type RegisteredTagItem = IRegisteredGrandfatheredTag | IRegisteredRedundantTag;
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* @public
|
|
1956
|
+
*/
|
|
1957
|
+
declare type RegisteredTagOrSubtag<TTYPE extends Model.RegistryEntryType, TTAG extends string> = IRegisteredSubtag<TTYPE, TTAG> | IRegisteredSubtagWithRange<TTYPE, TTAG> | IRegisteredTag<TTYPE, TTAG>;
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* @internal
|
|
1961
|
+
*/
|
|
1962
|
+
declare const registeredVariant: Converter<Items.IRegisteredVariant, unknown>;
|
|
1963
|
+
|
|
1964
|
+
/**
|
|
1965
|
+
* @internal
|
|
1966
|
+
*/
|
|
1967
|
+
declare const registeredVariant_2: Converter<Items.IRegisteredVariant, unknown>;
|
|
1968
|
+
|
|
1969
|
+
declare namespace Registry {
|
|
1970
|
+
export {
|
|
1971
|
+
registryEntryType,
|
|
1972
|
+
registryScopeType
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* @internal
|
|
1978
|
+
*/
|
|
1979
|
+
declare type RegistryEntry = LanguageSubtagRegistryEntry | ExtLangSubtagRegistryEntry | ScriptSubtagRegistryEntry | RegionSubtagRegistryEntry | VariantSubtagRegistryEntry | GrandfatheredTagRegistryEntry | RedundantTagRegistryEntry;
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* @internal
|
|
1983
|
+
*/
|
|
1984
|
+
declare type RegistryEntryScope = 'collection' | 'macrolanguage' | 'private-use' | 'special';
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* @internal
|
|
1988
|
+
*/
|
|
1989
|
+
declare type RegistryEntryType = 'extlang' | 'grandfathered' | 'language' | 'redundant' | 'region' | 'script' | 'variant';
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* @internal
|
|
1993
|
+
*/
|
|
1994
|
+
declare const registryEntryType: Converter<Model.RegistryEntryType, Model.RegistryEntryType[]>;
|
|
1995
|
+
|
|
1996
|
+
/**
|
|
1997
|
+
* @internal
|
|
1998
|
+
*/
|
|
1999
|
+
declare type RegistryFile = IDatedRegistry<RegistryEntry>;
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* @internal
|
|
2003
|
+
*/
|
|
2004
|
+
declare const registryFile: Converter<IDatedRegistry<Items.RegisteredItem>, unknown>;
|
|
2005
|
+
|
|
2006
|
+
/**
|
|
2007
|
+
* @public
|
|
2008
|
+
*/
|
|
2009
|
+
declare type RegistryFile_2 = IDatedRegistry<RegisteredItem>;
|
|
2010
|
+
|
|
2011
|
+
/**
|
|
2012
|
+
* @internal
|
|
2013
|
+
*/
|
|
2014
|
+
declare const registryFile_2: Converter<IDatedRegistry<Items.RegisteredItem>, unknown>;
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* @internal
|
|
2018
|
+
*/
|
|
2019
|
+
declare const registryScopeType: Converter<Model.RegistryEntryScope, Model.RegistryEntryScope[]>;
|
|
2020
|
+
|
|
2021
|
+
declare namespace Scope {
|
|
2022
|
+
export {
|
|
2023
|
+
LanguageSubtagScope,
|
|
2024
|
+
ExtLangSubtagScope,
|
|
2025
|
+
ScriptSubtagScope,
|
|
2026
|
+
RegionSubtagScope,
|
|
2027
|
+
VariantSubtagScope,
|
|
2028
|
+
GrandfatheredTagScope,
|
|
2029
|
+
RedundantTagScope
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* Script subtag in the IANA language subtag registry.
|
|
2035
|
+
* @public
|
|
2036
|
+
*/
|
|
2037
|
+
declare type ScriptSubtag = Brand<string, 'ScriptSubtag'>;
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* @public
|
|
2041
|
+
*/
|
|
2042
|
+
declare const scriptSubtag: Conversion.Converter<ScriptSubtag, unknown>;
|
|
2043
|
+
|
|
2044
|
+
/**
|
|
2045
|
+
* @public
|
|
2046
|
+
*/
|
|
2047
|
+
declare const scriptSubtag_2: RegExpValidationHelpers<ScriptSubtag, unknown>;
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* @internal
|
|
2051
|
+
*/
|
|
2052
|
+
declare type ScriptSubtagRegistryEntry = IRegistrySubtagEntry<'script', ScriptSubtag>;
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* @public
|
|
2056
|
+
*/
|
|
2057
|
+
declare class ScriptSubtagScope extends SubtagScopeWithRange<'script', ScriptSubtag, Items.IRegisteredScript> {
|
|
2058
|
+
constructor();
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/**
|
|
2062
|
+
* Determine how similar two language tags are to each other.
|
|
2063
|
+
*
|
|
2064
|
+
* @param t1 - First tag to match, supplied as one of `string`, individual
|
|
2065
|
+
* {@link Bcp47.Subtags | subtags}, or constructed
|
|
2066
|
+
* {@link Bcp47.LanguageTag | language tag}.
|
|
2067
|
+
* @param t2 - Second tag to match, supplied as one of `string`, individual
|
|
2068
|
+
* {@link Bcp47.Subtags | subtags}, or constructed
|
|
2069
|
+
* {@link Bcp47.LanguageTag | language tag}.
|
|
2070
|
+
* @param options - (optional) A set of {@link Bcp47.LanguageTagInitOptions | language tag options}
|
|
2071
|
+
* which control any necessary conversion or parsing.
|
|
2072
|
+
* @returns A numeric value in the range 1.0 (exact match) to 0.0 (no match).
|
|
2073
|
+
* @see For a set of common levels of similarity, see {@link Bcp47.tagSimilarity | similarity}.
|
|
2074
|
+
* @public
|
|
2075
|
+
*/
|
|
2076
|
+
declare function similarity(t1: LanguageSpec, t2: LanguageSpec, options?: ILanguageTagInitOptions): Result<number>;
|
|
2077
|
+
|
|
2078
|
+
declare namespace Subtags {
|
|
2079
|
+
export {
|
|
2080
|
+
Converters_7 as Converters,
|
|
2081
|
+
Model_8 as Model,
|
|
2082
|
+
Validate_4 as Validate
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
/**
|
|
2087
|
+
* @internal
|
|
2088
|
+
*/
|
|
2089
|
+
declare class SubtagScope<TTYPE extends Model.RegistryEntryType, TTAG extends string, TITEM extends Items.IRegisteredSubtag<TTYPE, TTAG>> extends RegisteredItemScope<TTYPE, TTAG, TITEM> {
|
|
2090
|
+
protected constructor(type: TTYPE, validate: ValidationHelpers<TTAG>);
|
|
2091
|
+
add(entry: TITEM): Result<true>;
|
|
2092
|
+
protected _validateEntry(entry: TITEM): Result<true>;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* @internal
|
|
2097
|
+
*/
|
|
2098
|
+
declare class SubtagScopeWithRange<TTYPE extends Model.RegistryEntryType, TTAG extends string, TITEM extends Items.IRegisteredSubtagWithRange<TTYPE, TTAG>> extends SubtagScope<TTYPE, TTAG, TITEM> {
|
|
2099
|
+
protected constructor(type: TTYPE, validate: ValidationHelpers<TTAG>);
|
|
2100
|
+
add(entry: TITEM): Result<true>;
|
|
2101
|
+
protected _validateEntry(entry: TITEM): Result<true>;
|
|
2102
|
+
protected _validateRange(start: TTAG, end: TTAG): Result<true>;
|
|
2103
|
+
protected _addRange(entry: TITEM): Result<true>;
|
|
2104
|
+
protected _nextInRange(current: TTAG, end: TTAG): TTAG | undefined;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* Converts {@link Bcp47.Subtags | subtags} to a string.
|
|
2109
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags} to be converted.
|
|
2110
|
+
* @returns A string representing the supplied {@link Bcp47.Subtags | subtags}.
|
|
2111
|
+
* @public
|
|
2112
|
+
*/
|
|
2113
|
+
declare function subtagsToString(subtags: ISubtags): string;
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* Creates a new {@link Bcp47.LanguageTag | language tag} from a {@link Bcp47.LanguageSpec | language specifier}
|
|
2117
|
+
*
|
|
2118
|
+
* The supplied initializer must be at least
|
|
2119
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | well-formed according to RFC 5646}.
|
|
2120
|
+
* Higher degrees of validation along with any normalizations may be optionally specified.
|
|
2121
|
+
*
|
|
2122
|
+
* @param from - The {@link Bcp47.LanguageSpec | language specifier} from which the tag is to
|
|
2123
|
+
* be created.
|
|
2124
|
+
* @param options - (optional) The {@link Bcp47.LanguageTagInitOptions | options} used to construct
|
|
2125
|
+
* and validate the tag.
|
|
2126
|
+
* @returns `Success` with a valid {@link Bcp47.LanguageTag | language tag} or `Failure` with details
|
|
2127
|
+
* if an error occurs.
|
|
2128
|
+
* @public
|
|
2129
|
+
*/
|
|
2130
|
+
declare function tag(from: LanguageSpec, options?: ILanguageTagInitOptions): Result<LanguageTag>;
|
|
2131
|
+
|
|
2132
|
+
/**
|
|
2133
|
+
* @public
|
|
2134
|
+
*/
|
|
2135
|
+
declare class TagExtensionsScope extends RegisteredItemScope<'language-tag-extension', Model_2.ExtensionSingleton, Model_2.ILanguageTagExtension> {
|
|
2136
|
+
constructor();
|
|
2137
|
+
add(entry: Model_2.ILanguageTagExtension): Result<true>;
|
|
2138
|
+
/**
|
|
2139
|
+
* Validates a single entry from a language tag extensions data file.
|
|
2140
|
+
* @param entry - The language tag extensions registry entry to be
|
|
2141
|
+
* validated.
|
|
2142
|
+
* @returns `Success` with `true` if the entry is valid, `Failure` with
|
|
2143
|
+
* details if an error occurs.
|
|
2144
|
+
* @internal
|
|
2145
|
+
*/
|
|
2146
|
+
protected _validateEntry(entry: Model_2.ILanguageTagExtension): Result<true>;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* Describes the degree of normalization of a language tag.
|
|
2151
|
+
* @public
|
|
2152
|
+
*/
|
|
2153
|
+
declare type TagNormalization = 'unknown' | 'none' | 'canonical' | 'preferred';
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* @internal
|
|
2157
|
+
*/
|
|
2158
|
+
declare function tagOrRange<TTAG extends string>(tagConverter: Converter<TTAG>): Converter<TTAG | TTAG[]>;
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* @internal
|
|
2162
|
+
*/
|
|
2163
|
+
declare function tagOrStartOfTagRange<TTAG extends string>(tagConverter: Converter<TTAG>): Converter<TTAG>;
|
|
2164
|
+
|
|
2165
|
+
declare namespace Tags {
|
|
2166
|
+
export {
|
|
2167
|
+
LanguageSubtags as Converters,
|
|
2168
|
+
Helpers,
|
|
2169
|
+
Validators,
|
|
2170
|
+
LanguageSubtag,
|
|
2171
|
+
ExtLangSubtag,
|
|
2172
|
+
ScriptSubtag,
|
|
2173
|
+
RegionSubtag,
|
|
2174
|
+
VariantSubtag,
|
|
2175
|
+
GrandfatheredTag,
|
|
2176
|
+
RedundantTag,
|
|
2177
|
+
ExtendedLanguageRange
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
/**
|
|
2182
|
+
* Creates an array of {@link Bcp47.LanguageTag | language tags} from an incoming array of
|
|
2183
|
+
* {@link Bcp47.LanguageSpec | language specifiers}.
|
|
2184
|
+
* @param from - The array of {@link Bcp47.LanguageSpec} to be converted.
|
|
2185
|
+
* @param options - (optional) The {@link Bcp47.LanguageTagInitOptions | options} used to construct
|
|
2186
|
+
* and validate any created tags.
|
|
2187
|
+
* @returns `Success` with an array of {@link Bcp47.LanguageTag | language tags}, or `Failure`
|
|
2188
|
+
* with details if an error occurs.
|
|
2189
|
+
* @public
|
|
2190
|
+
*/
|
|
2191
|
+
declare function tags(from: LanguageSpec[], options?: ILanguageTagInitOptions): Result<LanguageTag[]>;
|
|
2192
|
+
|
|
2193
|
+
declare namespace Tags_2 {
|
|
2194
|
+
export {
|
|
2195
|
+
LanguageSubtag,
|
|
2196
|
+
ExtLangSubtag,
|
|
2197
|
+
ScriptSubtag,
|
|
2198
|
+
RegionSubtag,
|
|
2199
|
+
VariantSubtag,
|
|
2200
|
+
GrandfatheredTag,
|
|
2201
|
+
RedundantTag,
|
|
2202
|
+
ExtendedLanguageRange
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* @internal
|
|
2208
|
+
*/
|
|
2209
|
+
declare class TagScope<TTYPE extends Model.RegistryEntryType, TTAG extends string, TITEM extends Items.IRegisteredTag<TTYPE, TTAG>> extends RegisteredItemScope<TTYPE, TTAG, TITEM> {
|
|
2210
|
+
protected constructor(type: TTYPE, validate: ValidationHelpers<TTAG>);
|
|
2211
|
+
add(entry: TITEM): Result<true>;
|
|
2212
|
+
protected _validateEntry(entry: TITEM): Result<true>;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Numeric representation of the quality of a language match.
|
|
2217
|
+
* Range is 0 (no match) to 1 (exact match).
|
|
2218
|
+
* @public
|
|
2219
|
+
*/
|
|
2220
|
+
declare type TagSimilarity = keyof typeof tagSimilarity;
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* Common levels of match quality for a single language match.
|
|
2224
|
+
* @public
|
|
2225
|
+
*/
|
|
2226
|
+
declare const tagSimilarity: {
|
|
2227
|
+
exact: number;
|
|
2228
|
+
variant: number;
|
|
2229
|
+
region: number;
|
|
2230
|
+
macroRegion: number;
|
|
2231
|
+
neutralRegion: number;
|
|
2232
|
+
preferredAffinity: number;
|
|
2233
|
+
affinity: number;
|
|
2234
|
+
preferredRegion: number;
|
|
2235
|
+
sibling: number;
|
|
2236
|
+
undetermined: number;
|
|
2237
|
+
none: number;
|
|
2238
|
+
};
|
|
2239
|
+
|
|
2240
|
+
/**
|
|
2241
|
+
* @internal
|
|
2242
|
+
*/
|
|
2243
|
+
declare class TagValidationHelpers<T extends string, TC = unknown> extends ValidationHelpers<T, TC> {
|
|
2244
|
+
readonly wellFormed: RegExp;
|
|
2245
|
+
constructor(description: string);
|
|
2246
|
+
static toCanonicalTag<T extends string>(val: T): Result<T>;
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2249
|
+
/**
|
|
2250
|
+
* Describes the validation level of a particular tag.
|
|
2251
|
+
* @public
|
|
2252
|
+
*/
|
|
2253
|
+
declare type TagValidity = 'unknown' | 'well-formed' | 'valid' | 'strictly-valid';
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Represents a UN M.49 numeric region code.
|
|
2257
|
+
* @public
|
|
2258
|
+
*/
|
|
2259
|
+
declare type UnM49RegionCode = Brand<string, 'UnM49RegionCode'>;
|
|
2260
|
+
|
|
2261
|
+
/**
|
|
2262
|
+
* Validating converter from string {@link Iana.Model.UnM49RegionCode}.
|
|
2263
|
+
* @public
|
|
2264
|
+
*/
|
|
2265
|
+
declare const unM49RegionCode: Converter<UnM49RegionCode, unknown>;
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* @public
|
|
2269
|
+
*/
|
|
2270
|
+
declare const unM49RegionCode_2: RegExpValidationHelpers<Model_5.UnM49RegionCode, unknown>;
|
|
2271
|
+
|
|
2272
|
+
declare namespace Unsd {
|
|
2273
|
+
export {
|
|
2274
|
+
DefaultRegistries_2 as DefaultRegistries,
|
|
2275
|
+
RegionCodes,
|
|
2276
|
+
Csv,
|
|
2277
|
+
IntermediateRegionTier,
|
|
2278
|
+
RegionTier,
|
|
2279
|
+
IGlobalRegion,
|
|
2280
|
+
IIntermediateRegion,
|
|
2281
|
+
Region,
|
|
2282
|
+
ICountryOrArea
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
export { Unsd }
|
|
2286
|
+
|
|
2287
|
+
declare namespace Utils {
|
|
2288
|
+
export {
|
|
2289
|
+
Normalizer,
|
|
2290
|
+
ValidationHelpers,
|
|
2291
|
+
IValidationHelpersConstructorParams as ValidationHelpersConstructorParams
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
export { Utils }
|
|
2295
|
+
|
|
2296
|
+
declare namespace Validate {
|
|
2297
|
+
export {
|
|
2298
|
+
languageSubtag_2 as languageSubtag,
|
|
2299
|
+
extlangSubtag_2 as extlangSubtag,
|
|
2300
|
+
scriptSubtag_2 as scriptSubtag,
|
|
2301
|
+
regionSubtag_2 as regionSubtag,
|
|
2302
|
+
variantSubtag_2 as variantSubtag,
|
|
2303
|
+
grandfatheredTag_2 as grandfatheredTag,
|
|
2304
|
+
redundantTag_2 as redundantTag,
|
|
2305
|
+
extendedLanguageRange_2 as extendedLanguageRange
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
declare namespace Validate_2 {
|
|
2310
|
+
export {
|
|
2311
|
+
extensionSingleton_2 as extensionSingleton
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
declare namespace Validate_3 {
|
|
2316
|
+
export {
|
|
2317
|
+
yearMonthDateSpec,
|
|
2318
|
+
isoAlpha2RegionCode_2 as isoAlpha2RegionCode,
|
|
2319
|
+
isoAlpha3RegionCode_2 as isoAlpha3RegionCode,
|
|
2320
|
+
unM49RegionCode_2 as unM49RegionCode
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
declare namespace Validate_4 {
|
|
2325
|
+
export {
|
|
2326
|
+
extensionSingleton_3 as extensionSingleton,
|
|
2327
|
+
extensionSubtag_2 as extensionSubtag,
|
|
2328
|
+
privateUsePrefix_2 as privateUsePrefix
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
/**
|
|
2333
|
+
* Validation helpers for BCP-47 language tags.
|
|
2334
|
+
* @public
|
|
2335
|
+
*/
|
|
2336
|
+
declare class ValidateTag {
|
|
2337
|
+
private static _isCanonical?;
|
|
2338
|
+
private static _isInPreferredForm?;
|
|
2339
|
+
private static _validators;
|
|
2340
|
+
/**
|
|
2341
|
+
* Determines if supplied {@link Bcp47.Subtags | subtags } are in canonical form,
|
|
2342
|
+
* meaning that they are at least well-formed as specified by
|
|
2343
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | RFC 5646}, and
|
|
2344
|
+
* all subtags are also
|
|
2345
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.1.1 | capitalized as recommended}.
|
|
2346
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to test.
|
|
2347
|
+
* @returns `true` if the {@link Bcp47.Subtags | subtags } represent
|
|
2348
|
+
* a language tag in canonical, false otherwise.
|
|
2349
|
+
* @example `en-US` is in canonical form, `en-us` is not.
|
|
2350
|
+
* @example `eng-US` is in canonical form, `eng-us` is not.
|
|
2351
|
+
*/
|
|
2352
|
+
static isCanonical(subtags: ISubtags): boolean;
|
|
2353
|
+
/**
|
|
2354
|
+
* Determines if supplied {@link Bcp47.Subtags | subtags } are
|
|
2355
|
+
* in preferred form. Preferred form is valid as specified by
|
|
2356
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | RFC 5646} and
|
|
2357
|
+
* also meets additional preferences specified in the
|
|
2358
|
+
* {@link https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | language subtag registry} -
|
|
2359
|
+
* extraneous (suppressed) script tags, deprecated language, extlang, script or region tags or
|
|
2360
|
+
* deprecated grandfathered or redundant tags (with a defined preferred-value) are not allowed.
|
|
2361
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to test.
|
|
2362
|
+
* @returns `true` if the {@link Bcp47.Subtags | subtags } represent
|
|
2363
|
+
* a valid language tag in preferred form, false otherwise.
|
|
2364
|
+
* @example `en-US` is in preferred form, `en-Latn-US` is not.
|
|
2365
|
+
* @example `cmn` is in preferred form, `zh-cmn-Hans` is not.
|
|
2366
|
+
*/
|
|
2367
|
+
static isInPreferredForm(subtags: ISubtags): boolean;
|
|
2368
|
+
/**
|
|
2369
|
+
* Determines if supplied {@link Bcp47.Subtags | subtags } are
|
|
2370
|
+
* strictly valid. A strictly valid tag is both
|
|
2371
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | valid as defined in the RFC}
|
|
2372
|
+
* and meets any other requirements such as
|
|
2373
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-3.1.8 | prefix validity}.
|
|
2374
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to test.
|
|
2375
|
+
* @returns `true` if the {@link Bcp47.Subtags | subtags } represent
|
|
2376
|
+
* a strictly valid language tag, false otherwise.
|
|
2377
|
+
* @example `ca-valencia` is strictly valid, `es-valencia` is not.
|
|
2378
|
+
*/
|
|
2379
|
+
static isStrictlyValid(subtags: ISubtags): boolean;
|
|
2380
|
+
/**
|
|
2381
|
+
* Determines if supplied {@link Bcp47.Subtags | subtags } are
|
|
2382
|
+
* valid as specified by {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | RFC 5646},
|
|
2383
|
+
* meaning that all subtags, or the tag itself for grandfathered tags, are defined in the
|
|
2384
|
+
* {@link https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry | IANA language subtag registry}.
|
|
2385
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to test.
|
|
2386
|
+
* @returns `true` if the {@link Bcp47.Subtags | subtags } represent
|
|
2387
|
+
* a valid language tag, false otherwise.
|
|
2388
|
+
* @example `en-US` is valid, `eng-US` is not.
|
|
2389
|
+
*/
|
|
2390
|
+
static isValid(subtags: ISubtags): boolean;
|
|
2391
|
+
/**
|
|
2392
|
+
* Determines if supplied {@link Bcp47.Subtags | subtags } are
|
|
2393
|
+
* well-formed as specified by {@link https://www.rfc-editor.org/rfc/rfc5646.html#section-2.2.9 | RFC 5646},
|
|
2394
|
+
* meaning that all subtags meet the grammar defined in the specification.
|
|
2395
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to test.
|
|
2396
|
+
* @returns `true` if the {@link Bcp47.Subtags | subtags } represent
|
|
2397
|
+
* a well-formed language tag, false otherwise.
|
|
2398
|
+
* @example `en-US` is valid, `english-US` is not.
|
|
2399
|
+
* @public
|
|
2400
|
+
*/
|
|
2401
|
+
static isWellFormed(subtags: ISubtags): boolean;
|
|
2402
|
+
/**
|
|
2403
|
+
* Chooses an appropriate default tag validator given desired and optional current
|
|
2404
|
+
* {@link Bcp47.TagValidity | validation level}.
|
|
2405
|
+
* @param wantValidity - The desired {@link Bcp47.TagValidity | validity level}.
|
|
2406
|
+
* @param haveValidity - (optional) The current {@link Bcp47.TagValidity | validity level}.
|
|
2407
|
+
* @returns An appropriate {@link Bcp47.TagValidator | tag validator} or `undefined` if no
|
|
2408
|
+
* additional validation is necessary.
|
|
2409
|
+
* @internal
|
|
2410
|
+
*/
|
|
2411
|
+
static chooseValidator(wantValidity: TagValidity, haveValidity?: TagValidity): ITagValidator | undefined;
|
|
2412
|
+
/**
|
|
2413
|
+
* Validates supplied {@link Bcp47.Subtags | subtags } to a requested
|
|
2414
|
+
* {@link Bcp47.TagValidity | validity level}, if necessary.
|
|
2415
|
+
* @param subtags - The {@link Bcp47.Subtags | subtags } to be validated.
|
|
2416
|
+
* @param wantValidity - The desired {@link Bcp47.TagValidity | validity level}.
|
|
2417
|
+
* @param haveValidity - (optional) The current {@link Bcp47.TagValidity | validity level}.
|
|
2418
|
+
* @returns `Success` with the validated {@link Bcp47.Subtags | subtags }, or
|
|
2419
|
+
* `Failure` with details if an error occurs.
|
|
2420
|
+
* @public
|
|
2421
|
+
*/
|
|
2422
|
+
static validateSubtags(subtags: ISubtags, wantValidity: TagValidity, haveValidity?: TagValidity): Result<boolean>;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2425
|
+
/**
|
|
2426
|
+
A collection of validation and normalization helpers for constrained string
|
|
2427
|
+
types.
|
|
2428
|
+
* @public
|
|
2429
|
+
*/
|
|
2430
|
+
declare class ValidationHelpers<T extends string, TC = unknown> {
|
|
2431
|
+
/**
|
|
2432
|
+
* Describes the group of tags validated by these helpers.
|
|
2433
|
+
*/
|
|
2434
|
+
readonly description: string;
|
|
2435
|
+
/**
|
|
2436
|
+
* A `Converter` which converts `unknown` to the tag type
|
|
2437
|
+
* validated by these helpers, if possible.
|
|
2438
|
+
*/
|
|
2439
|
+
readonly converter: Converter<T, TC>;
|
|
2440
|
+
/**
|
|
2441
|
+
* Determines is a supplied tag is well-formed according to the
|
|
2442
|
+
* lexical rules defined for the tag validated by these helpers.
|
|
2443
|
+
*/
|
|
2444
|
+
readonly isWellFormed: Validation.TypeGuardWithContext<T, TC>;
|
|
2445
|
+
/**
|
|
2446
|
+
* Determines is a supplied tag is well-formed and uses canonical
|
|
2447
|
+
* formatting, according to the lexical rules defined for the tag
|
|
2448
|
+
* validated by these helpers.
|
|
2449
|
+
*/
|
|
2450
|
+
readonly isCanonical: Validation.TypeGuardWithContext<T, TC>;
|
|
2451
|
+
/**
|
|
2452
|
+
* @internal
|
|
2453
|
+
*/
|
|
2454
|
+
protected readonly _toCanonical?: Normalizer<T, TC>;
|
|
2455
|
+
/**
|
|
2456
|
+
* Constructs new {@link Utils.ValidationHelpers | validation helpers}
|
|
2457
|
+
* from supplied initializers.
|
|
2458
|
+
* @param init - The {@link Utils.ValidationHelpersConstructorParams | constructor params}
|
|
2459
|
+
* used to initialize this {@link Utils.ValidationHelpers | validation helpers}.
|
|
2460
|
+
*/
|
|
2461
|
+
constructor(init: IValidationHelpersConstructorParams<T, TC>);
|
|
2462
|
+
/**
|
|
2463
|
+
* Converts a supplied `unknown` to the canonical form of the tag
|
|
2464
|
+
* validated by these helpers.
|
|
2465
|
+
* @param from - The `unknown` to be converted.
|
|
2466
|
+
* @param context - Optional context used in the conversion.
|
|
2467
|
+
* @returns `Success` with the corresponding canonical value,
|
|
2468
|
+
* or `Failure` with details if an error occurs.
|
|
2469
|
+
*/
|
|
2470
|
+
toCanonical(from: unknown, context?: TC): Result<T>;
|
|
2471
|
+
/**
|
|
2472
|
+
* Determines if a supplied `unknown` is a well-formed representation
|
|
2473
|
+
* of the tag validated by these helpers.
|
|
2474
|
+
* @param from - The `unknown` to be validated.
|
|
2475
|
+
* @param context - Optional context used in the validation.
|
|
2476
|
+
* @returns `Success` with the validated value, or `Failure` with details
|
|
2477
|
+
* if an error occurs.
|
|
2478
|
+
*/
|
|
2479
|
+
verifyIsWellFormed(from: unknown, context?: TC): Result<T>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Determines if a supplied `unknown` is a well-formed, canonical representation
|
|
2482
|
+
* of the tag validated by these helpers.
|
|
2483
|
+
* @param from - The `unknown` to be validated.
|
|
2484
|
+
* @param context - Optional context used in the validation.
|
|
2485
|
+
* @returns `Success` with the validated canonical value, or `Failure` with
|
|
2486
|
+
* details if an error occurs.
|
|
2487
|
+
*/
|
|
2488
|
+
verifyIsCanonical(from: unknown, context?: TC): Result<T>;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
declare namespace Validators {
|
|
2492
|
+
export {
|
|
2493
|
+
languageSubtag_2 as languageSubtag,
|
|
2494
|
+
extlangSubtag_2 as extlangSubtag,
|
|
2495
|
+
scriptSubtag_2 as scriptSubtag,
|
|
2496
|
+
regionSubtag_2 as regionSubtag,
|
|
2497
|
+
variantSubtag_2 as variantSubtag,
|
|
2498
|
+
grandfatheredTag_2 as grandfatheredTag,
|
|
2499
|
+
redundantTag_2 as redundantTag,
|
|
2500
|
+
extendedLanguageRange_2 as extendedLanguageRange
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* Variant subtag in the IANA language subtag registry.
|
|
2506
|
+
* @public
|
|
2507
|
+
*/
|
|
2508
|
+
declare type VariantSubtag = Brand<string, 'VariantSubtag'>;
|
|
2509
|
+
|
|
2510
|
+
/**
|
|
2511
|
+
* @public
|
|
2512
|
+
*/
|
|
2513
|
+
declare const variantSubtag: Conversion.Converter<VariantSubtag, unknown>;
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* @public
|
|
2517
|
+
*/
|
|
2518
|
+
declare const variantSubtag_2: RegExpValidationHelpers<VariantSubtag, unknown>;
|
|
2519
|
+
|
|
2520
|
+
/**
|
|
2521
|
+
* @internal
|
|
2522
|
+
*/
|
|
2523
|
+
declare type VariantSubtagRegistryEntry = IRegistrySubtagEntry<'variant', VariantSubtag>;
|
|
2524
|
+
|
|
2525
|
+
/**
|
|
2526
|
+
* @public
|
|
2527
|
+
*/
|
|
2528
|
+
declare class VariantSubtagScope extends SubtagScope<'variant', VariantSubtag, Items.IRegisteredVariant> {
|
|
2529
|
+
constructor();
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
/**
|
|
2533
|
+
* @public
|
|
2534
|
+
*/
|
|
2535
|
+
declare const yearMonthDateSpec: RegExpValidationHelpers<Model_5.YearMonthDaySpec, unknown>;
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* @public
|
|
2539
|
+
*/
|
|
2540
|
+
declare type YearMonthDaySpec = Brand<string, 'YearMonthDaySpec'>;
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
2543
|
+
* Validating converter from string {@link Iana.Model.YearMonthDaySpec}.
|
|
2544
|
+
* @public
|
|
2545
|
+
*/
|
|
2546
|
+
declare const yearMonthDaySpec: Converter<YearMonthDaySpec_2, unknown>;
|
|
2547
|
+
|
|
2548
|
+
/**
|
|
2549
|
+
* Represents a date string in the format YYYY-MM-DD.
|
|
2550
|
+
* @public
|
|
2551
|
+
*/
|
|
2552
|
+
declare type YearMonthDaySpec_2 = Brand<string, 'YearMonthDaySpec'>;
|
|
2553
|
+
|
|
2554
|
+
export { }
|