@digitaldefiance/i18n-lib 3.8.2 → 3.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/{active-context.ts → active-context.d.ts} +1 -0
- package/src/active-context.d.ts.map +1 -0
- package/src/active-context.js +3 -0
- package/src/active-context.js.map +1 -0
- package/src/builders/i18n-builder.d.ts +26 -0
- package/src/builders/i18n-builder.d.ts.map +1 -0
- package/src/builders/i18n-builder.js +70 -0
- package/src/builders/i18n-builder.js.map +1 -0
- package/src/builders/{index.ts → index.d.ts} +1 -1
- package/src/builders/index.d.ts.map +1 -0
- package/src/builders/index.js +8 -0
- package/src/builders/index.js.map +1 -0
- package/src/component-definition.d.ts +12 -0
- package/src/component-definition.d.ts.map +1 -0
- package/src/component-definition.js +3 -0
- package/src/component-definition.js.map +1 -0
- package/src/component-registration.d.ts +22 -0
- package/src/component-registration.d.ts.map +1 -0
- package/src/component-registration.js +3 -0
- package/src/component-registration.js.map +1 -0
- package/src/component-registry.d.ts +102 -0
- package/src/component-registry.d.ts.map +1 -0
- package/src/component-registry.js +282 -0
- package/src/component-registry.js.map +1 -0
- package/src/context-error-type.d.ts +8 -0
- package/src/context-error-type.d.ts.map +1 -0
- package/src/context-error-type.js +12 -0
- package/src/context-error-type.js.map +1 -0
- package/src/core/component-store.d.ts +93 -0
- package/src/core/component-store.d.ts.map +1 -0
- package/src/core/component-store.js +198 -0
- package/src/core/component-store.js.map +1 -0
- package/src/core/context-manager.d.ts +72 -0
- package/src/core/context-manager.d.ts.map +1 -0
- package/src/core/context-manager.js +98 -0
- package/src/core/context-manager.js.map +1 -0
- package/src/core/enum-registry.d.ts +48 -0
- package/src/core/enum-registry.d.ts.map +1 -0
- package/src/core/enum-registry.js +85 -0
- package/src/core/enum-registry.js.map +1 -0
- package/src/core/i18n-engine.d.ts +241 -0
- package/src/core/i18n-engine.d.ts.map +1 -0
- package/src/core/i18n-engine.js +568 -0
- package/src/core/i18n-engine.js.map +1 -0
- package/src/core/{index.ts → index.d.ts} +1 -4
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.js +21 -0
- package/src/core/index.js.map +1 -0
- package/src/core/language-registry.d.ts +180 -0
- package/src/core/language-registry.d.ts.map +1 -0
- package/src/core/language-registry.js +298 -0
- package/src/core/language-registry.js.map +1 -0
- package/src/{core-component-id.ts → core-component-id.d.ts} +2 -1
- package/src/core-component-id.d.ts.map +1 -0
- package/src/core-component-id.js +9 -0
- package/src/core-component-id.js.map +1 -0
- package/src/core-i18n.d.ts +69 -0
- package/src/core-i18n.d.ts.map +1 -0
- package/src/core-i18n.js +219 -0
- package/src/core-i18n.js.map +1 -0
- package/src/core-plugin-factory.d.ts +28 -0
- package/src/core-plugin-factory.d.ts.map +1 -0
- package/src/core-plugin-factory.js +80 -0
- package/src/core-plugin-factory.js.map +1 -0
- package/src/core-string-key.d.ts +52 -0
- package/src/core-string-key.d.ts.map +1 -0
- package/src/core-string-key.js +61 -0
- package/src/core-string-key.js.map +1 -0
- package/src/create-translation-adapter.d.ts +33 -0
- package/src/create-translation-adapter.d.ts.map +1 -0
- package/src/create-translation-adapter.js +72 -0
- package/src/create-translation-adapter.js.map +1 -0
- package/src/enum-registry.d.ts +65 -0
- package/src/enum-registry.d.ts.map +1 -0
- package/src/enum-registry.js +123 -0
- package/src/enum-registry.js.map +1 -0
- package/src/errors/{base.ts → base.d.ts} +1 -1
- package/src/errors/base.d.ts.map +1 -0
- package/src/errors/base.js +11 -0
- package/src/errors/base.js.map +1 -0
- package/src/errors/context-error.d.ts +50 -0
- package/src/errors/context-error.d.ts.map +1 -0
- package/src/errors/context-error.js +93 -0
- package/src/errors/context-error.js.map +1 -0
- package/src/errors/enhanced-error-base.d.ts +125 -0
- package/src/errors/enhanced-error-base.d.ts.map +1 -0
- package/src/errors/enhanced-error-base.js +165 -0
- package/src/errors/enhanced-error-base.js.map +1 -0
- package/src/errors/handleable.d.ts +83 -0
- package/src/errors/handleable.d.ts.map +1 -0
- package/src/errors/handleable.js +136 -0
- package/src/errors/handleable.js.map +1 -0
- package/src/errors/i18n-error.d.ts +211 -0
- package/src/errors/i18n-error.d.ts.map +1 -0
- package/src/errors/i18n-error.js +358 -0
- package/src/errors/i18n-error.js.map +1 -0
- package/src/errors/{index.ts → index.d.ts} +1 -4
- package/src/errors/index.d.ts.map +1 -0
- package/src/errors/index.js +17 -0
- package/src/errors/index.js.map +1 -0
- package/src/errors/simple-typed-error.d.ts +53 -0
- package/src/errors/simple-typed-error.d.ts.map +1 -0
- package/src/errors/simple-typed-error.js +51 -0
- package/src/errors/simple-typed-error.js.map +1 -0
- package/src/errors/{translatable-exports.ts → translatable-exports.d.ts} +1 -1
- package/src/errors/translatable-exports.d.ts.map +1 -0
- package/src/errors/translatable-exports.js +15 -0
- package/src/errors/translatable-exports.js.map +1 -0
- package/src/errors/translatable-generic.d.ts +87 -0
- package/src/errors/translatable-generic.d.ts.map +1 -0
- package/src/errors/translatable-generic.js +139 -0
- package/src/errors/translatable-generic.js.map +1 -0
- package/src/errors/translatable-handleable-generic.d.ts +116 -0
- package/src/errors/translatable-handleable-generic.d.ts.map +1 -0
- package/src/errors/translatable-handleable-generic.js +121 -0
- package/src/errors/translatable-handleable-generic.js.map +1 -0
- package/src/errors/translatable.d.ts +63 -0
- package/src/errors/translatable.d.ts.map +1 -0
- package/src/errors/translatable.js +85 -0
- package/src/errors/translatable.js.map +1 -0
- package/src/errors/typed-handleable.d.ts +62 -0
- package/src/errors/typed-handleable.d.ts.map +1 -0
- package/src/errors/typed-handleable.js +108 -0
- package/src/errors/typed-handleable.js.map +1 -0
- package/src/errors/typed.d.ts +206 -0
- package/src/errors/typed.d.ts.map +1 -0
- package/src/errors/typed.js +458 -0
- package/src/errors/typed.js.map +1 -0
- package/src/gender/{gender-categories.ts → gender-categories.d.ts} +2 -6
- package/src/gender/gender-categories.d.ts.map +1 -0
- package/src/gender/gender-categories.js +15 -0
- package/src/gender/gender-categories.js.map +1 -0
- package/src/gender/gender-resolver.d.ts +14 -0
- package/src/gender/gender-resolver.d.ts.map +1 -0
- package/src/gender/gender-resolver.js +35 -0
- package/src/gender/gender-resolver.js.map +1 -0
- package/src/gender/{index.ts → index.d.ts} +1 -0
- package/src/gender/index.d.ts.map +1 -0
- package/src/gender/index.js +6 -0
- package/src/gender/index.js.map +1 -0
- package/src/global-active-context.d.ts +50 -0
- package/src/global-active-context.d.ts.map +1 -0
- package/src/global-active-context.js +185 -0
- package/src/global-active-context.js.map +1 -0
- package/src/icu/ast.d.ts +48 -0
- package/src/icu/ast.d.ts.map +1 -0
- package/src/icu/ast.js +16 -0
- package/src/icu/ast.js.map +1 -0
- package/src/icu/compiler.d.ts +16 -0
- package/src/icu/compiler.d.ts.map +1 -0
- package/src/icu/compiler.js +87 -0
- package/src/icu/compiler.js.map +1 -0
- package/src/icu/formatter-registry.d.ts +10 -0
- package/src/icu/formatter-registry.d.ts.map +1 -0
- package/src/icu/formatter-registry.js +34 -0
- package/src/icu/formatter-registry.js.map +1 -0
- package/src/icu/formatters/base-formatter.d.ts +8 -0
- package/src/icu/formatters/base-formatter.d.ts.map +1 -0
- package/src/icu/formatters/base-formatter.js +3 -0
- package/src/icu/formatters/base-formatter.js.map +1 -0
- package/src/icu/formatters/date-formatter.d.ts +5 -0
- package/src/icu/formatters/date-formatter.d.ts.map +1 -0
- package/src/icu/formatters/date-formatter.js +31 -0
- package/src/icu/formatters/date-formatter.js.map +1 -0
- package/src/icu/formatters/number-formatter.d.ts +5 -0
- package/src/icu/formatters/number-formatter.d.ts.map +1 -0
- package/src/icu/formatters/number-formatter.js +33 -0
- package/src/icu/formatters/number-formatter.js.map +1 -0
- package/src/icu/formatters/plural-formatter.d.ts +5 -0
- package/src/icu/formatters/plural-formatter.d.ts.map +1 -0
- package/src/icu/formatters/plural-formatter.js +15 -0
- package/src/icu/formatters/plural-formatter.js.map +1 -0
- package/src/icu/formatters/select-formatter.d.ts +5 -0
- package/src/icu/formatters/select-formatter.d.ts.map +1 -0
- package/src/icu/formatters/select-formatter.js +10 -0
- package/src/icu/formatters/select-formatter.js.map +1 -0
- package/src/icu/formatters/selectordinal-formatter.d.ts +5 -0
- package/src/icu/formatters/selectordinal-formatter.d.ts.map +1 -0
- package/src/icu/formatters/selectordinal-formatter.js +22 -0
- package/src/icu/formatters/selectordinal-formatter.js.map +1 -0
- package/src/icu/formatters/time-formatter.d.ts +5 -0
- package/src/icu/formatters/time-formatter.d.ts.map +1 -0
- package/src/icu/formatters/time-formatter.js +31 -0
- package/src/icu/formatters/time-formatter.js.map +1 -0
- package/src/icu/helpers.d.ts +9 -0
- package/src/icu/helpers.d.ts.map +1 -0
- package/src/icu/helpers.js +31 -0
- package/src/icu/helpers.js.map +1 -0
- package/src/icu/parser.d.ts +31 -0
- package/src/icu/parser.d.ts.map +1 -0
- package/src/icu/parser.js +203 -0
- package/src/icu/parser.js.map +1 -0
- package/src/icu/runtime.d.ts +10 -0
- package/src/icu/runtime.d.ts.map +1 -0
- package/src/icu/runtime.js +33 -0
- package/src/icu/runtime.js.map +1 -0
- package/src/icu/tokenizer.d.ts +37 -0
- package/src/icu/tokenizer.d.ts.map +1 -0
- package/src/icu/tokenizer.js +187 -0
- package/src/icu/tokenizer.js.map +1 -0
- package/src/icu/validator.d.ts +11 -0
- package/src/icu/validator.d.ts.map +1 -0
- package/src/icu/validator.js +140 -0
- package/src/icu/validator.js.map +1 -0
- package/src/{index.ts → index.d.ts} +6 -38
- package/src/index.d.ts.map +1 -0
- package/src/index.js +76 -0
- package/src/index.js.map +1 -0
- package/src/interfaces/active-context.interface.d.ts +36 -0
- package/src/interfaces/active-context.interface.d.ts.map +1 -0
- package/src/interfaces/active-context.interface.js +3 -0
- package/src/interfaces/active-context.interface.js.map +1 -0
- package/src/interfaces/component-config.interface.d.ts +16 -0
- package/src/interfaces/component-config.interface.d.ts.map +1 -0
- package/src/interfaces/component-config.interface.js +6 -0
- package/src/interfaces/component-config.interface.js.map +1 -0
- package/src/interfaces/engine-config.interface.d.ts +22 -0
- package/src/interfaces/engine-config.interface.d.ts.map +1 -0
- package/src/interfaces/engine-config.interface.js +6 -0
- package/src/interfaces/engine-config.interface.js.map +1 -0
- package/src/interfaces/global-active-context.d.ts +23 -0
- package/src/interfaces/global-active-context.d.ts.map +1 -0
- package/src/interfaces/global-active-context.js +3 -0
- package/src/interfaces/global-active-context.js.map +1 -0
- package/src/interfaces/handleable-error-options.d.ts +14 -0
- package/src/interfaces/handleable-error-options.d.ts.map +1 -0
- package/src/interfaces/handleable-error-options.js +3 -0
- package/src/interfaces/handleable-error-options.js.map +1 -0
- package/src/interfaces/handleable.d.ts +21 -0
- package/src/interfaces/handleable.d.ts.map +1 -0
- package/src/interfaces/handleable.js +3 -0
- package/src/interfaces/handleable.js.map +1 -0
- package/src/interfaces/i18n-engine.interface.d.ts +46 -0
- package/src/interfaces/i18n-engine.interface.d.ts.map +1 -0
- package/src/interfaces/i18n-engine.interface.js +6 -0
- package/src/interfaces/i18n-engine.interface.js.map +1 -0
- package/src/interfaces/{index.ts → index.d.ts} +1 -1
- package/src/interfaces/index.d.ts.map +1 -0
- package/src/interfaces/index.js +7 -0
- package/src/interfaces/index.js.map +1 -0
- package/src/interfaces/language-definition.interface.d.ts +17 -0
- package/src/interfaces/language-definition.interface.d.ts.map +1 -0
- package/src/interfaces/language-definition.interface.js +6 -0
- package/src/interfaces/language-definition.interface.js.map +1 -0
- package/src/interfaces/translation-options.interface.d.ts +15 -0
- package/src/interfaces/translation-options.interface.d.ts.map +1 -0
- package/src/interfaces/translation-options.interface.js +6 -0
- package/src/interfaces/translation-options.interface.js.map +1 -0
- package/src/interfaces/validation-result.interface.d.ts +24 -0
- package/src/interfaces/validation-result.interface.d.ts.map +1 -0
- package/src/interfaces/validation-result.interface.js +6 -0
- package/src/interfaces/validation-result.interface.js.map +1 -0
- package/src/language-codes.d.ts +28 -0
- package/src/language-codes.d.ts.map +1 -0
- package/src/language-codes.js +32 -0
- package/src/language-codes.js.map +1 -0
- package/src/language-definition.d.ts +14 -0
- package/src/language-definition.d.ts.map +1 -0
- package/src/language-definition.js +3 -0
- package/src/language-definition.js.map +1 -0
- package/src/plugin-i18n-engine.d.ts +164 -0
- package/src/plugin-i18n-engine.d.ts.map +1 -0
- package/src/plugin-i18n-engine.js +493 -0
- package/src/plugin-i18n-engine.js.map +1 -0
- package/src/pluralization/{index.ts → index.d.ts} +1 -1
- package/src/pluralization/index.d.ts.map +1 -0
- package/src/pluralization/index.js +10 -0
- package/src/pluralization/index.js.map +1 -0
- package/src/pluralization/language-plural-map.d.ts +29 -0
- package/src/pluralization/language-plural-map.d.ts.map +1 -0
- package/src/pluralization/language-plural-map.js +155 -0
- package/src/pluralization/language-plural-map.js.map +1 -0
- package/src/pluralization/{plural-categories.ts → plural-categories.d.ts} +3 -5
- package/src/pluralization/plural-categories.d.ts.map +1 -0
- package/src/pluralization/plural-categories.js +8 -0
- package/src/pluralization/plural-categories.js.map +1 -0
- package/src/pluralization/plural-rules.d.ts +102 -0
- package/src/pluralization/plural-rules.d.ts.map +1 -0
- package/src/pluralization/plural-rules.js +263 -0
- package/src/pluralization/plural-rules.js.map +1 -0
- package/src/registry-config.d.ts +16 -0
- package/src/registry-config.d.ts.map +1 -0
- package/src/registry-config.js +3 -0
- package/src/registry-config.js.map +1 -0
- package/src/registry-error-type.d.ts +20 -0
- package/src/registry-error-type.d.ts.map +1 -0
- package/src/registry-error-type.js +24 -0
- package/src/registry-error-type.js.map +1 -0
- package/src/registry-error.d.ts +25 -0
- package/src/registry-error.d.ts.map +1 -0
- package/src/registry-error.js +63 -0
- package/src/registry-error.js.map +1 -0
- package/src/strict-types.d.ts +19 -0
- package/src/strict-types.d.ts.map +1 -0
- package/src/strict-types.js +18 -0
- package/src/strict-types.js.map +1 -0
- package/src/strings/de.d.ts +3 -0
- package/src/strings/de.d.ts.map +1 -0
- package/src/strings/de.js +57 -0
- package/src/strings/de.js.map +1 -0
- package/src/strings/en-GB.d.ts +3 -0
- package/src/strings/en-GB.d.ts.map +1 -0
- package/src/strings/en-GB.js +57 -0
- package/src/strings/en-GB.js.map +1 -0
- package/src/strings/en-US.d.ts +3 -0
- package/src/strings/en-US.d.ts.map +1 -0
- package/src/strings/en-US.js +57 -0
- package/src/strings/en-US.js.map +1 -0
- package/src/strings/es.d.ts +3 -0
- package/src/strings/es.d.ts.map +1 -0
- package/src/strings/es.js +57 -0
- package/src/strings/es.js.map +1 -0
- package/src/strings/fr.d.ts +3 -0
- package/src/strings/fr.d.ts.map +1 -0
- package/src/strings/fr.js +57 -0
- package/src/strings/fr.js.map +1 -0
- package/src/strings/ja.d.ts +3 -0
- package/src/strings/ja.d.ts.map +1 -0
- package/src/strings/ja.js +57 -0
- package/src/strings/ja.js.map +1 -0
- package/src/strings/uk.d.ts +3 -0
- package/src/strings/uk.d.ts.map +1 -0
- package/src/strings/uk.js +57 -0
- package/src/strings/uk.js.map +1 -0
- package/src/strings/zh-CN.d.ts +3 -0
- package/src/strings/zh-CN.d.ts.map +1 -0
- package/src/strings/zh-CN.js +57 -0
- package/src/strings/zh-CN.js.map +1 -0
- package/src/template.d.ts +13 -0
- package/src/template.d.ts.map +1 -0
- package/src/template.js +40 -0
- package/src/template.js.map +1 -0
- package/src/translation-engine.d.ts +9 -0
- package/src/translation-engine.d.ts.map +1 -0
- package/src/translation-engine.js +3 -0
- package/src/translation-engine.js.map +1 -0
- package/src/translation-request.d.ts +10 -0
- package/src/translation-request.d.ts.map +1 -0
- package/src/translation-request.js +3 -0
- package/src/translation-request.js.map +1 -0
- package/src/translation-response.d.ts +9 -0
- package/src/translation-response.d.ts.map +1 -0
- package/src/translation-response.js +3 -0
- package/src/translation-response.js.map +1 -0
- package/src/types/engine.d.ts +47 -0
- package/src/types/engine.d.ts.map +1 -0
- package/src/types/engine.js +8 -0
- package/src/types/engine.js.map +1 -0
- package/src/types/{index.ts → index.d.ts} +1 -1
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.js +9 -0
- package/src/types/index.js.map +1 -0
- package/src/types/{plural-types.ts → plural-types.d.ts} +3 -29
- package/src/types/plural-types.d.ts.map +1 -0
- package/src/types/plural-types.js +39 -0
- package/src/types/plural-types.js.map +1 -0
- package/src/{types.ts → types.d.ts} +21 -72
- package/src/types.d.ts.map +1 -0
- package/src/types.js +23 -0
- package/src/types.js.map +1 -0
- package/src/utils/currency.d.ts +81 -0
- package/src/utils/currency.d.ts.map +1 -0
- package/src/utils/currency.js +99 -0
- package/src/utils/currency.js.map +1 -0
- package/src/utils/html-escape.d.ts +22 -0
- package/src/utils/html-escape.d.ts.map +1 -0
- package/src/utils/html-escape.js +53 -0
- package/src/utils/html-escape.js.map +1 -0
- package/src/utils/{index.ts → index.d.ts} +1 -0
- package/src/utils/index.d.ts.map +1 -0
- package/src/utils/index.js +12 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/lru-cache.d.ts +42 -0
- package/src/utils/lru-cache.d.ts.map +1 -0
- package/src/utils/lru-cache.js +73 -0
- package/src/utils/lru-cache.js.map +1 -0
- package/src/utils/{plural-helpers.ts → plural-helpers.d.ts} +4 -14
- package/src/utils/plural-helpers.d.ts.map +1 -0
- package/src/utils/plural-helpers.js +35 -0
- package/src/utils/plural-helpers.js.map +1 -0
- package/src/utils/safe-object.d.ts +39 -0
- package/src/utils/safe-object.d.ts.map +1 -0
- package/src/utils/{safe-object.ts → safe-object.js} +34 -37
- package/src/utils/safe-object.js.map +1 -0
- package/src/utils/string-utils.d.ts +28 -0
- package/src/utils/string-utils.d.ts.map +1 -0
- package/src/utils/string-utils.js +63 -0
- package/src/utils/string-utils.js.map +1 -0
- package/src/utils/timezone.d.ts +50 -0
- package/src/utils/timezone.d.ts.map +1 -0
- package/src/utils/timezone.js +74 -0
- package/src/utils/timezone.js.map +1 -0
- package/src/utils/validation.d.ts +40 -0
- package/src/utils/validation.d.ts.map +1 -0
- package/src/utils/validation.js +69 -0
- package/src/utils/validation.js.map +1 -0
- package/src/utils.d.ts +65 -0
- package/src/utils.d.ts.map +1 -0
- package/src/utils.js +129 -0
- package/src/utils.js.map +1 -0
- package/src/validation/{index.ts → index.d.ts} +1 -0
- package/src/validation/index.d.ts.map +1 -0
- package/src/validation/index.js +5 -0
- package/src/validation/index.js.map +1 -0
- package/src/validation/plural-validator.d.ts +46 -0
- package/src/validation/plural-validator.d.ts.map +1 -0
- package/src/validation/plural-validator.js +123 -0
- package/src/validation/plural-validator.js.map +1 -0
- package/src/validation-config.d.ts +12 -0
- package/src/validation-config.d.ts.map +1 -0
- package/src/validation-config.js +3 -0
- package/src/validation-config.js.map +1 -0
- package/src/validation-result.d.ts +13 -0
- package/src/validation-result.d.ts.map +1 -0
- package/src/validation-result.js +3 -0
- package/src/validation-result.js.map +1 -0
- package/LICENSE +0 -21
- package/src/builders/i18n-builder.ts +0 -82
- package/src/component-definition.ts +0 -11
- package/src/component-registration.ts +0 -29
- package/src/component-registry.ts +0 -432
- package/src/context-error-type.ts +0 -7
- package/src/core/component-store.ts +0 -241
- package/src/core/context-manager.ts +0 -113
- package/src/core/enum-registry.ts +0 -106
- package/src/core/i18n-engine.ts +0 -710
- package/src/core/language-registry.ts +0 -345
- package/src/core-i18n.ts +0 -270
- package/src/core-plugin-factory.ts +0 -111
- package/src/core-string-key.ts +0 -59
- package/src/create-translation-adapter.ts +0 -93
- package/src/enum-registry.ts +0 -152
- package/src/errors/context-error.ts +0 -122
- package/src/errors/enhanced-error-base.ts +0 -260
- package/src/errors/handleable.ts +0 -152
- package/src/errors/i18n-error.ts +0 -494
- package/src/errors/simple-typed-error.ts +0 -81
- package/src/errors/translatable-generic.ts +0 -245
- package/src/errors/translatable-handleable-generic.ts +0 -222
- package/src/errors/translatable.ts +0 -138
- package/src/errors/typed-handleable.ts +0 -138
- package/src/errors/typed.ts +0 -617
- package/src/gender/gender-resolver.ts +0 -40
- package/src/global-active-context.ts +0 -266
- package/src/icu/ast.ts +0 -56
- package/src/icu/compiler.ts +0 -96
- package/src/icu/formatter-registry.ts +0 -36
- package/src/icu/formatters/base-formatter.ts +0 -8
- package/src/icu/formatters/date-formatter.ts +0 -30
- package/src/icu/formatters/number-formatter.ts +0 -32
- package/src/icu/formatters/plural-formatter.ts +0 -12
- package/src/icu/formatters/select-formatter.ts +0 -7
- package/src/icu/formatters/selectordinal-formatter.ts +0 -17
- package/src/icu/formatters/time-formatter.ts +0 -30
- package/src/icu/helpers.ts +0 -34
- package/src/icu/parser.ts +0 -242
- package/src/icu/runtime.ts +0 -37
- package/src/icu/tokenizer.ts +0 -212
- package/src/icu/validator.ts +0 -163
- package/src/interfaces/active-context.interface.ts +0 -41
- package/src/interfaces/component-config.interface.ts +0 -17
- package/src/interfaces/engine-config.interface.ts +0 -22
- package/src/interfaces/global-active-context.ts +0 -39
- package/src/interfaces/handleable-error-options.ts +0 -13
- package/src/interfaces/handleable.ts +0 -20
- package/src/interfaces/i18n-engine.interface.ts +0 -57
- package/src/interfaces/language-definition.interface.ts +0 -17
- package/src/interfaces/translation-options.interface.ts +0 -15
- package/src/interfaces/validation-result.interface.ts +0 -24
- package/src/language-codes.ts +0 -40
- package/src/language-definition.ts +0 -13
- package/src/plugin-i18n-engine.ts +0 -707
- package/src/pluralization/language-plural-map.ts +0 -186
- package/src/pluralization/plural-rules.ts +0 -228
- package/src/registry-config.ts +0 -16
- package/src/registry-error-type.ts +0 -19
- package/src/registry-error.ts +0 -100
- package/src/strict-types.ts +0 -35
- package/src/strings/de.ts +0 -75
- package/src/strings/en-GB.ts +0 -74
- package/src/strings/en-US.ts +0 -74
- package/src/strings/es.ts +0 -74
- package/src/strings/fr.ts +0 -75
- package/src/strings/ja.ts +0 -73
- package/src/strings/uk.ts +0 -73
- package/src/strings/zh-CN.ts +0 -72
- package/src/template.ts +0 -72
- package/src/translation-engine.ts +0 -18
- package/src/translation-request.ts +0 -12
- package/src/translation-response.ts +0 -8
- package/src/types/engine.ts +0 -55
- package/src/utils/currency.ts +0 -141
- package/src/utils/html-escape.ts +0 -55
- package/src/utils/lru-cache.ts +0 -76
- package/src/utils/string-utils.ts +0 -77
- package/src/utils/timezone.ts +0 -76
- package/src/utils/validation.ts +0 -66
- package/src/utils.ts +0 -215
- package/src/validation/plural-validator.ts +0 -168
- package/src/validation-config.ts +0 -11
- package/src/validation-result.ts +0 -12
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Language to Plural Rule Mapping
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
LanguagePluralForms,
|
|
7
|
-
PluralCategory,
|
|
8
|
-
PluralRuleFunction,
|
|
9
|
-
} from './plural-categories';
|
|
10
|
-
import {
|
|
11
|
-
pluralRuleArabic,
|
|
12
|
-
pluralRuleBreton,
|
|
13
|
-
pluralRuleChinese,
|
|
14
|
-
pluralRuleCzech,
|
|
15
|
-
pluralRuleEnglish,
|
|
16
|
-
pluralRuleFrench,
|
|
17
|
-
pluralRuleGerman,
|
|
18
|
-
pluralRuleIrish,
|
|
19
|
-
pluralRuleJapanese,
|
|
20
|
-
pluralRuleLatvian,
|
|
21
|
-
pluralRuleLithuanian,
|
|
22
|
-
pluralRulePolish,
|
|
23
|
-
pluralRuleRomanian,
|
|
24
|
-
pluralRuleRussian,
|
|
25
|
-
pluralRuleScottishGaelic,
|
|
26
|
-
pluralRuleSlovenian,
|
|
27
|
-
pluralRuleSpanish,
|
|
28
|
-
pluralRuleUkrainian,
|
|
29
|
-
pluralRuleWelsh,
|
|
30
|
-
} from './plural-rules';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Map of language codes to plural rule functions
|
|
34
|
-
*/
|
|
35
|
-
export const LANGUAGE_PLURAL_RULES: Record<string, PluralRuleFunction> = {
|
|
36
|
-
en: pluralRuleEnglish,
|
|
37
|
-
'en-US': pluralRuleEnglish,
|
|
38
|
-
'en-GB': pluralRuleEnglish,
|
|
39
|
-
ru: pluralRuleRussian,
|
|
40
|
-
ar: pluralRuleArabic,
|
|
41
|
-
pl: pluralRulePolish,
|
|
42
|
-
fr: pluralRuleFrench,
|
|
43
|
-
es: pluralRuleSpanish,
|
|
44
|
-
ja: pluralRuleJapanese,
|
|
45
|
-
uk: pluralRuleUkrainian,
|
|
46
|
-
zh: pluralRuleChinese,
|
|
47
|
-
'zh-CN': pluralRuleChinese,
|
|
48
|
-
de: pluralRuleGerman,
|
|
49
|
-
gd: pluralRuleScottishGaelic,
|
|
50
|
-
cy: pluralRuleWelsh,
|
|
51
|
-
br: pluralRuleBreton,
|
|
52
|
-
sl: pluralRuleSlovenian,
|
|
53
|
-
cs: pluralRuleCzech,
|
|
54
|
-
lt: pluralRuleLithuanian,
|
|
55
|
-
lv: pluralRuleLatvian,
|
|
56
|
-
ga: pluralRuleIrish,
|
|
57
|
-
ro: pluralRuleRomanian,
|
|
58
|
-
// Common languages reusing existing rules
|
|
59
|
-
it: pluralRuleEnglish,
|
|
60
|
-
pt: pluralRuleEnglish,
|
|
61
|
-
'pt-BR': pluralRuleFrench, // Brazilian Portuguese: 0 and 1 use 'one'
|
|
62
|
-
nl: pluralRuleEnglish,
|
|
63
|
-
sv: pluralRuleEnglish,
|
|
64
|
-
no: pluralRuleEnglish,
|
|
65
|
-
da: pluralRuleEnglish,
|
|
66
|
-
fi: pluralRuleEnglish,
|
|
67
|
-
el: pluralRuleEnglish,
|
|
68
|
-
tr: pluralRuleJapanese,
|
|
69
|
-
ko: pluralRuleJapanese,
|
|
70
|
-
vi: pluralRuleJapanese,
|
|
71
|
-
th: pluralRuleJapanese,
|
|
72
|
-
id: pluralRuleJapanese,
|
|
73
|
-
ms: pluralRuleJapanese,
|
|
74
|
-
he: pluralRuleEnglish, // Simplified - full Hebrew is more complex
|
|
75
|
-
hi: pluralRuleFrench,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Map of language codes to required/optional plural forms
|
|
80
|
-
*/
|
|
81
|
-
export const LANGUAGE_PLURAL_FORMS: Record<string, LanguagePluralForms> = {
|
|
82
|
-
en: { required: ['one', 'other'], optional: ['zero'] },
|
|
83
|
-
'en-US': { required: ['one', 'other'], optional: ['zero'] },
|
|
84
|
-
'en-GB': { required: ['one', 'other'], optional: ['zero'] },
|
|
85
|
-
ru: { required: ['one', 'few', 'many'], optional: ['zero'] },
|
|
86
|
-
ar: {
|
|
87
|
-
required: ['zero', 'one', 'two', 'few', 'many', 'other'],
|
|
88
|
-
optional: [],
|
|
89
|
-
},
|
|
90
|
-
pl: { required: ['one', 'few', 'many'], optional: ['zero', 'other'] },
|
|
91
|
-
fr: { required: ['one', 'other'], optional: ['zero'] },
|
|
92
|
-
es: { required: ['one', 'other'], optional: ['zero'] },
|
|
93
|
-
ja: { required: ['other'], optional: [] },
|
|
94
|
-
uk: { required: ['one', 'few', 'many'], optional: ['zero'] },
|
|
95
|
-
zh: { required: ['other'], optional: [] },
|
|
96
|
-
'zh-CN': { required: ['other'], optional: [] },
|
|
97
|
-
de: { required: ['one', 'other'], optional: ['zero'] },
|
|
98
|
-
gd: { required: ['one', 'two', 'few', 'other'], optional: [] },
|
|
99
|
-
cy: {
|
|
100
|
-
required: ['zero', 'one', 'two', 'few', 'many', 'other'],
|
|
101
|
-
optional: [],
|
|
102
|
-
},
|
|
103
|
-
br: { required: ['one', 'two', 'few', 'many', 'other'], optional: [] },
|
|
104
|
-
sl: { required: ['one', 'two', 'few', 'other'], optional: [] },
|
|
105
|
-
cs: { required: ['one', 'few', 'many', 'other'], optional: [] },
|
|
106
|
-
lt: { required: ['one', 'few', 'many', 'other'], optional: [] },
|
|
107
|
-
lv: { required: ['zero', 'one', 'other'], optional: [] },
|
|
108
|
-
ga: { required: ['one', 'two', 'few', 'many', 'other'], optional: [] },
|
|
109
|
-
ro: { required: ['one', 'few', 'other'], optional: [] },
|
|
110
|
-
// Common languages
|
|
111
|
-
it: { required: ['one', 'other'], optional: ['zero'] },
|
|
112
|
-
pt: { required: ['one', 'other'], optional: ['zero'] },
|
|
113
|
-
'pt-BR': { required: ['one', 'other'], optional: ['zero'] },
|
|
114
|
-
nl: { required: ['one', 'other'], optional: ['zero'] },
|
|
115
|
-
sv: { required: ['one', 'other'], optional: ['zero'] },
|
|
116
|
-
no: { required: ['one', 'other'], optional: ['zero'] },
|
|
117
|
-
da: { required: ['one', 'other'], optional: ['zero'] },
|
|
118
|
-
fi: { required: ['one', 'other'], optional: ['zero'] },
|
|
119
|
-
el: { required: ['one', 'other'], optional: ['zero'] },
|
|
120
|
-
tr: { required: ['other'], optional: [] },
|
|
121
|
-
ko: { required: ['other'], optional: [] },
|
|
122
|
-
vi: { required: ['other'], optional: [] },
|
|
123
|
-
th: { required: ['other'], optional: [] },
|
|
124
|
-
id: { required: ['other'], optional: [] },
|
|
125
|
-
ms: { required: ['other'], optional: [] },
|
|
126
|
-
he: { required: ['one', 'other'], optional: ['zero'] },
|
|
127
|
-
hi: { required: ['one', 'other'], optional: ['zero'] },
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Get plural category for a number in a specific language
|
|
132
|
-
*/
|
|
133
|
-
export function getPluralCategory(
|
|
134
|
-
language: string,
|
|
135
|
-
count: number,
|
|
136
|
-
): PluralCategory {
|
|
137
|
-
// Handle invalid inputs
|
|
138
|
-
if (typeof count !== 'number' || !isFinite(count)) {
|
|
139
|
-
return 'other';
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Get the plural rule for the language
|
|
143
|
-
const rule = LANGUAGE_PLURAL_RULES[language] || LANGUAGE_PLURAL_RULES['en'];
|
|
144
|
-
|
|
145
|
-
// Apply the rule
|
|
146
|
-
return rule(Math.abs(count));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Get required plural forms for a language
|
|
151
|
-
*/
|
|
152
|
-
export function getRequiredPluralForms(language: string): string[] {
|
|
153
|
-
const forms = LANGUAGE_PLURAL_FORMS[language] || LANGUAGE_PLURAL_FORMS['en'];
|
|
154
|
-
return forms.required;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Get all plural forms (required + optional) for a language
|
|
159
|
-
*/
|
|
160
|
-
export function getAllPluralForms(language: string): string[] {
|
|
161
|
-
const forms = LANGUAGE_PLURAL_FORMS[language] || LANGUAGE_PLURAL_FORMS['en'];
|
|
162
|
-
return [...forms.required, ...forms.optional];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Check if a language has a specific plural form
|
|
167
|
-
*/
|
|
168
|
-
export function hasPluralForm(language: string, category: string): boolean {
|
|
169
|
-
const forms = LANGUAGE_PLURAL_FORMS[language] || LANGUAGE_PLURAL_FORMS['en'];
|
|
170
|
-
// Type guard to check if category is a valid PluralCategory
|
|
171
|
-
const validCategories: readonly string[] = [
|
|
172
|
-
'zero',
|
|
173
|
-
'one',
|
|
174
|
-
'two',
|
|
175
|
-
'few',
|
|
176
|
-
'many',
|
|
177
|
-
'other',
|
|
178
|
-
];
|
|
179
|
-
if (!validCategories.includes(category)) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
return (
|
|
183
|
-
forms.required.includes(category as PluralCategory) ||
|
|
184
|
-
forms.optional.includes(category as PluralCategory)
|
|
185
|
-
);
|
|
186
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLDR Plural Rules Implementation
|
|
3
|
-
* Based on Unicode CLDR plural rules for cardinal numbers
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { PluralCategory, PluralRuleFunction } from './plural-categories';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* English plural rule (en-US, en-GB)
|
|
10
|
-
* Forms: one, other
|
|
11
|
-
*/
|
|
12
|
-
export const pluralRuleEnglish: PluralRuleFunction = (n: number): PluralCategory => {
|
|
13
|
-
if (n === 1) return 'one';
|
|
14
|
-
return 'other';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Russian plural rule (ru)
|
|
19
|
-
* Forms: one, few, many
|
|
20
|
-
*/
|
|
21
|
-
export const pluralRuleRussian: PluralRuleFunction = (n: number): PluralCategory => {
|
|
22
|
-
const mod10 = n % 10;
|
|
23
|
-
const mod100 = n % 100;
|
|
24
|
-
|
|
25
|
-
if (mod10 === 1 && mod100 !== 11) return 'one';
|
|
26
|
-
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return 'few';
|
|
27
|
-
return 'many';
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Arabic plural rule (ar)
|
|
32
|
-
* Forms: zero, one, two, few, many, other
|
|
33
|
-
*/
|
|
34
|
-
export const pluralRuleArabic: PluralRuleFunction = (n: number): PluralCategory => {
|
|
35
|
-
if (n === 0) return 'zero';
|
|
36
|
-
if (n === 1) return 'one';
|
|
37
|
-
if (n === 2) return 'two';
|
|
38
|
-
|
|
39
|
-
const mod100 = n % 100;
|
|
40
|
-
if (mod100 >= 3 && mod100 <= 10) return 'few';
|
|
41
|
-
if (mod100 >= 11) return 'many';
|
|
42
|
-
return 'other';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Polish plural rule (pl)
|
|
47
|
-
* Forms: one, few, many, other
|
|
48
|
-
*/
|
|
49
|
-
export const pluralRulePolish: PluralRuleFunction = (n: number): PluralCategory => {
|
|
50
|
-
// Fractional numbers use "other"
|
|
51
|
-
if (n !== Math.floor(n)) return 'other';
|
|
52
|
-
|
|
53
|
-
if (n === 1) return 'one';
|
|
54
|
-
|
|
55
|
-
const mod10 = n % 10;
|
|
56
|
-
const mod100 = n % 100;
|
|
57
|
-
|
|
58
|
-
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return 'few';
|
|
59
|
-
if (n !== 1 && (mod10 === 0 || mod10 === 1 || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 12 && mod100 <= 14))) return 'many';
|
|
60
|
-
return 'other';
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* French plural rule (fr)
|
|
65
|
-
* Forms: one, other
|
|
66
|
-
*/
|
|
67
|
-
export const pluralRuleFrench: PluralRuleFunction = (n: number): PluralCategory => {
|
|
68
|
-
if (n === 0 || n === 1) return 'one';
|
|
69
|
-
return 'other';
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Spanish plural rule (es)
|
|
74
|
-
* Forms: one, other
|
|
75
|
-
*/
|
|
76
|
-
export const pluralRuleSpanish: PluralRuleFunction = (n: number): PluralCategory => {
|
|
77
|
-
if (n === 1) return 'one';
|
|
78
|
-
return 'other';
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Japanese plural rule (ja)
|
|
83
|
-
* Forms: other (no plural distinction)
|
|
84
|
-
*/
|
|
85
|
-
export const pluralRuleJapanese: PluralRuleFunction = (n: number): PluralCategory => {
|
|
86
|
-
return 'other';
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Ukrainian plural rule (uk)
|
|
91
|
-
* Forms: one, few, many (same as Russian)
|
|
92
|
-
*/
|
|
93
|
-
export const pluralRuleUkrainian: PluralRuleFunction = pluralRuleRussian;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Chinese plural rule (zh-CN)
|
|
97
|
-
* Forms: other (no plural distinction)
|
|
98
|
-
*/
|
|
99
|
-
export const pluralRuleChinese: PluralRuleFunction = (n: number): PluralCategory => {
|
|
100
|
-
return 'other';
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* German plural rule (de)
|
|
105
|
-
* Forms: one, other
|
|
106
|
-
*/
|
|
107
|
-
export const pluralRuleGerman: PluralRuleFunction = (n: number): PluralCategory => {
|
|
108
|
-
if (n === 1) return 'one';
|
|
109
|
-
return 'other';
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Scottish Gaelic plural rule (gd)
|
|
114
|
-
* Forms: one, two, few, other
|
|
115
|
-
* One of the most complex plural systems
|
|
116
|
-
*/
|
|
117
|
-
export const pluralRuleScottishGaelic: PluralRuleFunction = (n: number): PluralCategory => {
|
|
118
|
-
if (n === 1 || n === 11) return 'one';
|
|
119
|
-
if (n === 2 || n === 12) return 'two';
|
|
120
|
-
if ((n >= 3 && n <= 10) || (n >= 13 && n <= 19)) return 'few';
|
|
121
|
-
return 'other';
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Welsh plural rule (cy)
|
|
126
|
-
* Forms: zero, one, two, few, many, other
|
|
127
|
-
*/
|
|
128
|
-
export const pluralRuleWelsh: PluralRuleFunction = (n: number): PluralCategory => {
|
|
129
|
-
if (n === 0) return 'zero';
|
|
130
|
-
if (n === 1) return 'one';
|
|
131
|
-
if (n === 2) return 'two';
|
|
132
|
-
if (n === 3) return 'few';
|
|
133
|
-
if (n === 6) return 'many';
|
|
134
|
-
return 'other';
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Breton plural rule (br)
|
|
139
|
-
* Forms: one, two, few, many, other
|
|
140
|
-
*/
|
|
141
|
-
export const pluralRuleBreton: PluralRuleFunction = (n: number): PluralCategory => {
|
|
142
|
-
const mod10 = n % 10;
|
|
143
|
-
const mod100 = n % 100;
|
|
144
|
-
|
|
145
|
-
if (mod10 === 1 && mod100 !== 11 && mod100 !== 71 && mod100 !== 91) return 'one';
|
|
146
|
-
if (mod10 === 2 && mod100 !== 12 && mod100 !== 72 && mod100 !== 92) return 'two';
|
|
147
|
-
if ((mod10 === 3 || mod10 === 4 || mod10 === 9) &&
|
|
148
|
-
(mod100 < 10 || mod100 > 19) &&
|
|
149
|
-
(mod100 < 70 || mod100 > 79) &&
|
|
150
|
-
(mod100 < 90 || mod100 > 99)) return 'few';
|
|
151
|
-
if (n !== 0 && n % 1000000 === 0) return 'many';
|
|
152
|
-
return 'other';
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Slovenian plural rule (sl)
|
|
157
|
-
* Forms: one, two, few, other
|
|
158
|
-
*/
|
|
159
|
-
export const pluralRuleSlovenian: PluralRuleFunction = (n: number): PluralCategory => {
|
|
160
|
-
const mod100 = n % 100;
|
|
161
|
-
|
|
162
|
-
if (mod100 === 1) return 'one';
|
|
163
|
-
if (mod100 === 2) return 'two';
|
|
164
|
-
if (mod100 === 3 || mod100 === 4) return 'few';
|
|
165
|
-
return 'other';
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Czech plural rule (cs)
|
|
170
|
-
* Forms: one, few, many, other
|
|
171
|
-
*/
|
|
172
|
-
export const pluralRuleCzech: PluralRuleFunction = (n: number): PluralCategory => {
|
|
173
|
-
if (n === 1) return 'one';
|
|
174
|
-
if (n >= 2 && n <= 4) return 'few';
|
|
175
|
-
if (n !== Math.floor(n)) return 'many';
|
|
176
|
-
return 'other';
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Lithuanian plural rule (lt)
|
|
181
|
-
* Forms: one, few, many, other
|
|
182
|
-
*/
|
|
183
|
-
export const pluralRuleLithuanian: PluralRuleFunction = (n: number): PluralCategory => {
|
|
184
|
-
const mod10 = n % 10;
|
|
185
|
-
const mod100 = n % 100;
|
|
186
|
-
|
|
187
|
-
if (mod10 === 1 && (mod100 < 11 || mod100 > 19)) return 'one';
|
|
188
|
-
if (mod10 >= 2 && mod10 <= 9 && (mod100 < 11 || mod100 > 19)) return 'few';
|
|
189
|
-
if (n !== Math.floor(n)) return 'many';
|
|
190
|
-
return 'other';
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Latvian plural rule (lv)
|
|
195
|
-
* Forms: zero, one, other
|
|
196
|
-
*/
|
|
197
|
-
export const pluralRuleLatvian: PluralRuleFunction = (n: number): PluralCategory => {
|
|
198
|
-
const mod10 = n % 10;
|
|
199
|
-
const mod100 = n % 100;
|
|
200
|
-
|
|
201
|
-
if (n === 0) return 'zero';
|
|
202
|
-
if (mod10 === 1 && mod100 !== 11) return 'one';
|
|
203
|
-
return 'other';
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Irish plural rule (ga)
|
|
208
|
-
* Forms: one, two, few, many, other
|
|
209
|
-
*/
|
|
210
|
-
export const pluralRuleIrish: PluralRuleFunction = (n: number): PluralCategory => {
|
|
211
|
-
if (n === 1) return 'one';
|
|
212
|
-
if (n === 2) return 'two';
|
|
213
|
-
if (n >= 3 && n <= 6) return 'few';
|
|
214
|
-
if (n >= 7 && n <= 10) return 'many';
|
|
215
|
-
return 'other';
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Romanian plural rule (ro)
|
|
220
|
-
* Forms: one, few, other
|
|
221
|
-
*/
|
|
222
|
-
export const pluralRuleRomanian: PluralRuleFunction = (n: number): PluralCategory => {
|
|
223
|
-
const mod100 = n % 100;
|
|
224
|
-
|
|
225
|
-
if (n === 1) return 'one';
|
|
226
|
-
if (n === 0 || (mod100 >= 1 && mod100 <= 19)) return 'few';
|
|
227
|
-
return 'other';
|
|
228
|
-
}
|
package/src/registry-config.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CurrencyCode } from './utils/currency';
|
|
2
|
-
import { Timezone } from './utils/timezone';
|
|
3
|
-
import { ValidationConfig } from './validation-config';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Registry configuration
|
|
7
|
-
*/
|
|
8
|
-
export interface RegistryConfig<TLanguages extends string> {
|
|
9
|
-
readonly defaultLanguage: TLanguages;
|
|
10
|
-
readonly fallbackLanguage: TLanguages;
|
|
11
|
-
readonly defaultCurrencyCode: CurrencyCode;
|
|
12
|
-
readonly timezone: Timezone;
|
|
13
|
-
readonly adminTimezone: Timezone;
|
|
14
|
-
readonly validation: ValidationConfig;
|
|
15
|
-
readonly constants?: Record<string, any>;
|
|
16
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error types for registry operations
|
|
3
|
-
*/
|
|
4
|
-
export enum RegistryErrorType {
|
|
5
|
-
/** Error when a requested component is not found in the registry */
|
|
6
|
-
ComponentNotFound = 'COMPONENT_NOT_FOUND',
|
|
7
|
-
/** Error when a requested language is not found in the registry */
|
|
8
|
-
LanguageNotFound = 'LANGUAGE_NOT_FOUND',
|
|
9
|
-
/** Error when a requested string key is not found in a component */
|
|
10
|
-
StringKeyNotFound = 'STRING_KEY_NOT_FOUND',
|
|
11
|
-
/** Error when component registration is incomplete (missing strings) */
|
|
12
|
-
IncompleteRegistration = 'INCOMPLETE_REGISTRATION',
|
|
13
|
-
/** Error when attempting to register a component that already exists */
|
|
14
|
-
DuplicateComponent = 'DUPLICATE_COMPONENT',
|
|
15
|
-
/** Error when attempting to register a language that already exists */
|
|
16
|
-
DuplicateLanguage = 'DUPLICATE_LANGUAGE',
|
|
17
|
-
/** Error when component validation fails */
|
|
18
|
-
ValidationFailed = 'VALIDATION_FAILED',
|
|
19
|
-
}
|
package/src/registry-error.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// CoreLanguageCode is deprecated - using string
|
|
2
|
-
import { CoreI18nComponentId } from './core-component-id';
|
|
3
|
-
import { CoreStringKey } from './core-string-key';
|
|
4
|
-
import { RegistryErrorType } from './registry-error-type';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Minimal translation engine interface to avoid circular dependencies
|
|
8
|
-
*/
|
|
9
|
-
export interface RegistryTranslationEngine {
|
|
10
|
-
safeTranslate(
|
|
11
|
-
componentId: string,
|
|
12
|
-
key: string,
|
|
13
|
-
variables?: Record<string, string | number>,
|
|
14
|
-
language?: string,
|
|
15
|
-
): string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Reason map for registry errors
|
|
20
|
-
*/
|
|
21
|
-
const REGISTRY_ERROR_REASON_MAP = {
|
|
22
|
-
[RegistryErrorType.ComponentNotFound]:
|
|
23
|
-
CoreStringKey.Error_ComponentNotFoundTemplate,
|
|
24
|
-
[RegistryErrorType.DuplicateComponent]:
|
|
25
|
-
CoreStringKey.Error_DuplicateComponentTemplate,
|
|
26
|
-
[RegistryErrorType.DuplicateLanguage]:
|
|
27
|
-
CoreStringKey.Error_DuplicateLanguageTemplate,
|
|
28
|
-
[RegistryErrorType.IncompleteRegistration]:
|
|
29
|
-
CoreStringKey.Error_IncompleteRegistrationTemplate,
|
|
30
|
-
[RegistryErrorType.LanguageNotFound]:
|
|
31
|
-
CoreStringKey.Error_LanguageNotFoundTemplate,
|
|
32
|
-
[RegistryErrorType.StringKeyNotFound]:
|
|
33
|
-
CoreStringKey.Error_StringKeyNotFoundTemplate,
|
|
34
|
-
[RegistryErrorType.ValidationFailed]:
|
|
35
|
-
CoreStringKey.Error_ValidationFailedTemplate,
|
|
36
|
-
} as const;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Registry error class that can work with plugin engines
|
|
40
|
-
*/
|
|
41
|
-
export class RegistryError extends Error {
|
|
42
|
-
constructor(
|
|
43
|
-
public override readonly type: RegistryErrorType,
|
|
44
|
-
message: string,
|
|
45
|
-
public override readonly metadata?: Record<string, any>,
|
|
46
|
-
) {
|
|
47
|
-
super(message);
|
|
48
|
-
this.name = 'RegistryError';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Create a registry error with translation support
|
|
53
|
-
* Uses lazy initialization to avoid circular dependencies
|
|
54
|
-
*/
|
|
55
|
-
static createWithEngine(
|
|
56
|
-
engine: RegistryTranslationEngine,
|
|
57
|
-
type: RegistryErrorType,
|
|
58
|
-
variables?: Record<string, string | number>,
|
|
59
|
-
language?: string,
|
|
60
|
-
metadata?: Record<string, any>,
|
|
61
|
-
): RegistryError {
|
|
62
|
-
const key = REGISTRY_ERROR_REASON_MAP[type];
|
|
63
|
-
let message: string;
|
|
64
|
-
|
|
65
|
-
if (key && engine) {
|
|
66
|
-
try {
|
|
67
|
-
// Try to translate the error message using the engine
|
|
68
|
-
message = engine.safeTranslate(
|
|
69
|
-
CoreI18nComponentId,
|
|
70
|
-
key,
|
|
71
|
-
variables,
|
|
72
|
-
language,
|
|
73
|
-
);
|
|
74
|
-
} catch (translationError) {
|
|
75
|
-
// Fallback if translation fails
|
|
76
|
-
message = `Error: ${type}${
|
|
77
|
-
metadata ? ` - ${JSON.stringify(metadata)}` : ''
|
|
78
|
-
}`;
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
// Fallback to a basic English message
|
|
82
|
-
message = `Error: ${type}${
|
|
83
|
-
metadata ? ` - ${JSON.stringify(metadata)}` : ''
|
|
84
|
-
}`;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return new RegistryError(type, message, metadata);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Create a simple RegistryError without engine dependency
|
|
92
|
-
*/
|
|
93
|
-
static createSimple(
|
|
94
|
-
type: RegistryErrorType,
|
|
95
|
-
message: string,
|
|
96
|
-
metadata?: Record<string, any>,
|
|
97
|
-
): RegistryError {
|
|
98
|
-
return new RegistryError(type, message, metadata);
|
|
99
|
-
}
|
|
100
|
-
}
|
package/src/strict-types.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enforces that for each language L, all string keys K are present.
|
|
3
|
-
*/
|
|
4
|
-
export type CompleteLanguageStrings<TStringKey extends string> = {
|
|
5
|
-
[K in TStringKey]: string;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export type CompleteComponentLanguageStrings<
|
|
9
|
-
TStringKey extends string,
|
|
10
|
-
TLanguages extends string,
|
|
11
|
-
> = {
|
|
12
|
-
[L in TLanguages]: CompleteLanguageStrings<TStringKey>;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Helper to assert at compile-time that an object is a complete component language map.
|
|
17
|
-
* Returns the object unchanged at runtime.
|
|
18
|
-
*/
|
|
19
|
-
export function createCompleteComponentStrings<
|
|
20
|
-
TStringKey extends string,
|
|
21
|
-
TLanguages extends string,
|
|
22
|
-
>(
|
|
23
|
-
obj: CompleteComponentLanguageStrings<TStringKey, TLanguages>,
|
|
24
|
-
): CompleteComponentLanguageStrings<TStringKey, TLanguages> {
|
|
25
|
-
return obj;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Utility to extract missing keys at compile time (identity, purely for readability)
|
|
30
|
-
*/
|
|
31
|
-
export function defineLanguageStrings<TStringKey extends string>(
|
|
32
|
-
strings: CompleteLanguageStrings<TStringKey>,
|
|
33
|
-
): CompleteLanguageStrings<TStringKey> {
|
|
34
|
-
return strings;
|
|
35
|
-
}
|
package/src/strings/de.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { CoreStringKey } from '../core-string-key';
|
|
2
|
-
|
|
3
|
-
export const germanStrings: Record<CoreStringKey, string> = {
|
|
4
|
-
// Common/General
|
|
5
|
-
[CoreStringKey.Common_Yes]: 'Ja',
|
|
6
|
-
[CoreStringKey.Common_No]: 'Nein',
|
|
7
|
-
[CoreStringKey.Common_Cancel]: 'Abbrechen',
|
|
8
|
-
[CoreStringKey.Common_OK]: 'OK',
|
|
9
|
-
[CoreStringKey.Common_Save]: 'Speichern',
|
|
10
|
-
[CoreStringKey.Common_Delete]: 'Löschen',
|
|
11
|
-
[CoreStringKey.Common_Edit]: 'Bearbeiten',
|
|
12
|
-
[CoreStringKey.Common_Create]: 'Erstellen',
|
|
13
|
-
[CoreStringKey.Common_Update]: 'Aktualisieren',
|
|
14
|
-
[CoreStringKey.Common_Loading]: 'Lädt...',
|
|
15
|
-
[CoreStringKey.Common_Error]: 'Fehler',
|
|
16
|
-
[CoreStringKey.Common_Success]: 'Erfolg',
|
|
17
|
-
[CoreStringKey.Common_Warning]: 'Warnung',
|
|
18
|
-
[CoreStringKey.Common_Info]: 'Information',
|
|
19
|
-
[CoreStringKey.Common_Disposed]: 'Objekt wurde freigegeben',
|
|
20
|
-
[CoreStringKey.Common_Test]: 'Test',
|
|
21
|
-
|
|
22
|
-
// Error Messages
|
|
23
|
-
[CoreStringKey.Error_InvalidInput]: 'Ungültige Eingabe bereitgestellt',
|
|
24
|
-
[CoreStringKey.Error_NetworkError]: 'Netzwerkverbindungsfehler',
|
|
25
|
-
[CoreStringKey.Error_NotFound]: 'Ressource nicht gefunden',
|
|
26
|
-
[CoreStringKey.Error_AccessDenied]: 'Zugriff verweigert',
|
|
27
|
-
[CoreStringKey.Error_InternalServer]: 'Interner Serverfehler',
|
|
28
|
-
[CoreStringKey.Error_ValidationFailed]: 'Validierung fehlgeschlagen',
|
|
29
|
-
[CoreStringKey.Error_RequiredField]: 'Dieses Feld ist erforderlich',
|
|
30
|
-
[CoreStringKey.Error_InvalidContext]: 'Ungültiger Kontext',
|
|
31
|
-
[CoreStringKey.Error_InvalidContextTemplate]:
|
|
32
|
-
'Ungültiger Kontext: {contextKey}',
|
|
33
|
-
[CoreStringKey.Error_MissingTranslationKeyTemplate]:
|
|
34
|
-
'Fehlender Übersetzungsschlüssel: {stringKey}',
|
|
35
|
-
[CoreStringKey.Error_InvalidCurrencyCodeTemplate]: 'Ungültiger Währungscode: {value}',
|
|
36
|
-
|
|
37
|
-
// Registry Error Templates
|
|
38
|
-
[CoreStringKey.Error_ComponentNotFoundTemplate]:
|
|
39
|
-
'Komponente "{componentId}" nicht gefunden',
|
|
40
|
-
[CoreStringKey.Error_LanguageNotFoundTemplate]:
|
|
41
|
-
'Sprache "{language}" nicht gefunden',
|
|
42
|
-
[CoreStringKey.Error_StringKeyNotFoundTemplate]:
|
|
43
|
-
'String-Schlüssel "{stringKey}" für Komponente "{componentId}" nicht gefunden',
|
|
44
|
-
[CoreStringKey.Error_IncompleteRegistrationTemplate]:
|
|
45
|
-
'Unvollständige Registrierung für Komponente "{componentId}": {missingCount} Strings fehlen',
|
|
46
|
-
[CoreStringKey.Error_DuplicateComponentTemplate]:
|
|
47
|
-
'Komponente "{componentId}" ist bereits registriert',
|
|
48
|
-
[CoreStringKey.Error_DuplicateLanguageTemplate]:
|
|
49
|
-
'Sprache "{languageId}" ist bereits registriert',
|
|
50
|
-
[CoreStringKey.Error_ValidationFailedTemplate]:
|
|
51
|
-
'Validierung für Komponente "{componentId}" fehlgeschlagen: {errorCount} Fehler',
|
|
52
|
-
|
|
53
|
-
// System Messages
|
|
54
|
-
[CoreStringKey.System_Welcome]: 'Willkommen',
|
|
55
|
-
[CoreStringKey.System_Goodbye]: 'Auf Wiedersehen',
|
|
56
|
-
[CoreStringKey.System_PleaseWait]: 'Bitte warten...',
|
|
57
|
-
[CoreStringKey.System_ProcessingRequest]:
|
|
58
|
-
'Ihre Anfrage wird bearbeitet...',
|
|
59
|
-
[CoreStringKey.System_OperationComplete]:
|
|
60
|
-
'Vorgang erfolgreich abgeschlossen',
|
|
61
|
-
[CoreStringKey.System_NoDataAvailable]: 'Keine Daten verfügbar',
|
|
62
|
-
|
|
63
|
-
[CoreStringKey.Error_InstanceAlreadyExistsTemplate]:
|
|
64
|
-
"Instanz mit Schlüssel '{key}' existiert bereits",
|
|
65
|
-
[CoreStringKey.Error_InstanceNotFoundTemplate]:
|
|
66
|
-
"Instanz mit Schlüssel '{key}' nicht gefunden",
|
|
67
|
-
[CoreStringKey.Error_MissingStringCollectionTemplate]:
|
|
68
|
-
'Fehlende String-Sammlung für Sprache: {language}',
|
|
69
|
-
[CoreStringKey.Error_MissingTranslationTemplate]:
|
|
70
|
-
"Fehlende Übersetzung für Schlüssel '{key}' in Sprache '{language}'",
|
|
71
|
-
[CoreStringKey.Error_DefaultLanguageNoCollectionTemplate]:
|
|
72
|
-
"Standardsprache '{language}' hat keine String-Sammlung",
|
|
73
|
-
[CoreStringKey.Error_MissingTranslationKeyForTypeTemplate]:
|
|
74
|
-
'Fehlender Übersetzungsschlüssel für Typ: {type}',
|
|
75
|
-
};
|