@digitaldefiance/i18n-lib 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -87
- package/package.json +4 -3
- package/src/active-context.d.ts +30 -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/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 +10 -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 +69 -0
- package/src/component-registry.d.ts.map +1 -0
- package/src/component-registry.js +248 -0
- package/src/component-registry.js.map +1 -0
- package/src/context-error-type.d.ts +4 -0
- package/src/context-error-type.d.ts.map +1 -0
- package/src/context-error-type.js +8 -0
- package/src/context-error-type.js.map +1 -0
- package/src/context-error.d.ts +7 -0
- package/src/context-error.d.ts.map +1 -0
- package/src/context-error.js +18 -0
- package/src/context-error.js.map +1 -0
- package/src/context-manager.d.ts +34 -0
- package/src/context-manager.d.ts.map +1 -0
- package/src/context-manager.js +60 -0
- package/src/context-manager.js.map +1 -0
- package/src/context.d.ts +45 -0
- package/src/context.d.ts.map +1 -0
- package/src/context.js +70 -0
- package/src/context.js.map +1 -0
- package/src/core-i18n.d.ts +63 -0
- package/src/core-i18n.d.ts.map +1 -0
- package/src/core-i18n.js +478 -0
- package/src/core-i18n.js.map +1 -0
- package/src/core-string-key.d.ts +43 -0
- package/src/core-string-key.d.ts.map +1 -0
- package/src/core-string-key.js +51 -0
- package/src/core-string-key.js.map +1 -0
- package/src/create-translation-adapter.d.ts +21 -0
- package/src/create-translation-adapter.d.ts.map +1 -0
- package/src/create-translation-adapter.js +37 -0
- package/src/create-translation-adapter.js.map +1 -0
- package/src/currency-code.d.ts +20 -0
- package/src/currency-code.d.ts.map +1 -0
- package/src/currency-code.js +37 -0
- package/src/currency-code.js.map +1 -0
- package/src/{currency-format.ts → currency-format.d.ts} +5 -5
- package/src/currency-format.d.ts.map +1 -0
- package/src/currency-format.js +3 -0
- package/src/currency-format.js.map +1 -0
- package/src/currency.d.ts +12 -0
- package/src/currency.d.ts.map +1 -0
- package/src/currency.js +49 -0
- package/src/currency.js.map +1 -0
- package/src/default-config.d.ts +33 -0
- package/src/default-config.d.ts.map +1 -0
- package/src/default-config.js +102 -0
- package/src/default-config.js.map +1 -0
- package/src/enum-registry.d.ts +45 -0
- package/src/enum-registry.d.ts.map +1 -0
- package/src/enum-registry.js +103 -0
- package/src/enum-registry.js.map +1 -0
- package/src/global-active-context.d.ts +51 -0
- package/src/global-active-context.d.ts.map +1 -0
- package/src/global-active-context.js +179 -0
- package/src/global-active-context.js.map +1 -0
- package/src/handleable.d.ts +14 -0
- package/src/handleable.d.ts.map +1 -0
- package/src/handleable.js +66 -0
- package/src/handleable.js.map +1 -0
- package/src/i-global-active-context.d.ts +23 -0
- package/src/i-global-active-context.d.ts.map +1 -0
- package/src/i-global-active-context.js +3 -0
- package/src/i-global-active-context.js.map +1 -0
- package/src/i-handleable-error-options.d.ts +7 -0
- package/src/i-handleable-error-options.d.ts.map +1 -0
- package/src/i-handleable-error-options.js +3 -0
- package/src/i-handleable-error-options.js.map +1 -0
- package/src/i-handleable.d.ts +6 -0
- package/src/i-handleable.d.ts.map +1 -0
- package/src/i-handleable.js +3 -0
- package/src/i-handleable.js.map +1 -0
- package/src/i18n-config.d.ts +21 -0
- package/src/i18n-config.d.ts.map +1 -0
- package/src/i18n-config.js +3 -0
- package/src/i18n-config.js.map +1 -0
- package/src/{i18n-context.ts → i18n-context.d.ts} +7 -7
- package/src/i18n-context.d.ts.map +1 -0
- package/src/i18n-context.js +3 -0
- package/src/i18n-context.js.map +1 -0
- package/src/i18n-engine.d.ts +179 -0
- package/src/i18n-engine.d.ts.map +1 -0
- package/src/i18n-engine.js +355 -0
- package/src/i18n-engine.js.map +1 -0
- package/src/{index.ts → index.d.ts} +2 -10
- package/src/index.d.ts.map +1 -0
- package/src/index.js +71 -0
- package/src/index.js.map +1 -0
- package/src/{language-codes.ts → language-codes.d.ts} +12 -23
- 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/language-registry.d.ts +114 -0
- package/src/language-registry.d.ts.map +1 -0
- package/src/language-registry.js +217 -0
- package/src/language-registry.js.map +1 -0
- package/src/plugin-i18n-engine.d.ts +151 -0
- package/src/plugin-i18n-engine.d.ts.map +1 -0
- package/src/plugin-i18n-engine.js +380 -0
- package/src/plugin-i18n-engine.js.map +1 -0
- package/src/plugin-translatable-generic-error.d.ts +30 -0
- package/src/plugin-translatable-generic-error.d.ts.map +1 -0
- package/src/plugin-translatable-generic-error.js +72 -0
- package/src/plugin-translatable-generic-error.js.map +1 -0
- package/src/plugin-translatable-handleable-generic.d.ts +29 -0
- package/src/plugin-translatable-handleable-generic.d.ts.map +1 -0
- package/src/plugin-translatable-handleable-generic.js +44 -0
- package/src/plugin-translatable-handleable-generic.js.map +1 -0
- package/src/plugin-typed-handleable.d.ts +15 -0
- package/src/plugin-typed-handleable.d.ts.map +1 -0
- package/src/plugin-typed-handleable.js +51 -0
- package/src/plugin-typed-handleable.js.map +1 -0
- package/src/registry-config.d.ts +15 -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 +13 -0
- package/src/registry-error-type.d.ts.map +1 -0
- package/src/registry-error-type.js +17 -0
- package/src/registry-error-type.js.map +1 -0
- package/src/registry-error.d.ts +19 -0
- package/src/registry-error.d.ts.map +1 -0
- package/src/registry-error.js +48 -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/template.d.ts +13 -0
- package/src/template.d.ts.map +1 -0
- package/src/template.js +31 -0
- package/src/template.js.map +1 -0
- package/src/timezone.d.ts +12 -0
- package/src/timezone.d.ts.map +1 -0
- package/src/timezone.js +24 -0
- package/src/timezone.js.map +1 -0
- package/src/translatable.d.ts +6 -0
- package/src/translatable.d.ts.map +1 -0
- package/src/translatable.js +12 -0
- package/src/translatable.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/typed-error.d.ts +73 -0
- package/src/typed-error.d.ts.map +1 -0
- package/src/typed-error.js +267 -0
- package/src/typed-error.js.map +1 -0
- package/src/typed-handleable.d.ts +15 -0
- package/src/typed-handleable.d.ts.map +1 -0
- package/src/typed-handleable.js +46 -0
- package/src/typed-handleable.js.map +1 -0
- package/src/{types.ts → types.d.ts} +21 -75
- package/src/types.d.ts.map +1 -0
- package/src/types.js +19 -0
- package/src/types.js.map +1 -0
- package/src/unified-translator.d.ts +31 -0
- package/src/unified-translator.d.ts.map +1 -0
- package/src/unified-translator.js +71 -0
- package/src/unified-translator.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-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/active-context.ts +0 -30
- package/src/component-definition.ts +0 -11
- package/src/component-registration.ts +0 -13
- package/src/component-registry.ts +0 -392
- package/src/context-error-type.ts +0 -3
- package/src/context-error.ts +0 -16
- package/src/context-manager.ts +0 -71
- package/src/context.ts +0 -90
- package/src/core-i18n.ts +0 -609
- package/src/core-string-key.ts +0 -49
- package/src/create-translation-adapter.ts +0 -47
- package/src/currency-code.ts +0 -35
- package/src/currency.ts +0 -52
- package/src/default-config.ts +0 -199
- package/src/enum-registry.ts +0 -138
- package/src/global-active-context.ts +0 -255
- package/src/handleable.ts +0 -79
- package/src/i-global-active-context.ts +0 -59
- package/src/i-handleable-error-options.ts +0 -6
- package/src/i-handleable.ts +0 -5
- package/src/i18n-config.ts +0 -29
- package/src/i18n-engine.ts +0 -491
- package/src/language-definition.ts +0 -13
- package/src/language-registry.ts +0 -292
- package/src/plugin-i18n-engine.ts +0 -520
- package/src/plugin-translatable-generic-error.ts +0 -106
- package/src/plugin-translatable-handleable-generic.ts +0 -60
- package/src/plugin-typed-handleable.ts +0 -77
- package/src/registry-config.ts +0 -15
- package/src/registry-error-type.ts +0 -12
- package/src/registry-error.ts +0 -74
- package/src/strict-types.ts +0 -35
- package/src/template.ts +0 -63
- package/src/timezone.ts +0 -20
- package/src/translatable.ts +0 -15
- package/src/translation-engine.ts +0 -8
- package/src/translation-request.ts +0 -12
- package/src/translation-response.ts +0 -8
- package/src/typed-error.ts +0 -384
- package/src/typed-handleable.ts +0 -70
- package/src/unified-translator.ts +0 -96
- package/src/utils.ts +0 -213
- package/src/validation-config.ts +0 -11
- package/src/validation-result.ts +0 -12
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoreTypedError = exports.PluginTypedError = exports.TypedError = exports.BaseTypedError = void 0;
|
|
4
|
+
exports.createPluginTypedError = createPluginTypedError;
|
|
5
|
+
exports.createCoreTypedError = createCoreTypedError;
|
|
6
|
+
exports.createTranslatedError = createTranslatedError;
|
|
7
|
+
// Legacy imports (for backward compatibility)
|
|
8
|
+
const default_config_1 = require("./default-config");
|
|
9
|
+
// New plugin architecture imports
|
|
10
|
+
// CoreLanguageCode is deprecated - using string for flexibility
|
|
11
|
+
const core_string_key_1 = require("./core-string-key");
|
|
12
|
+
const plugin_i18n_engine_1 = require("./plugin-i18n-engine");
|
|
13
|
+
/**
|
|
14
|
+
* Base typed error class with common patterns
|
|
15
|
+
*/
|
|
16
|
+
class BaseTypedError extends Error {
|
|
17
|
+
type;
|
|
18
|
+
metadata;
|
|
19
|
+
constructor(type, message, metadata) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.type = type;
|
|
22
|
+
this.metadata = metadata;
|
|
23
|
+
this.name = this.constructor.name;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a simple typed error without engine dependency
|
|
27
|
+
*/
|
|
28
|
+
static createSimple(type, message, metadata) {
|
|
29
|
+
return new this(type, message, metadata);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a typed error with translation support
|
|
33
|
+
*/
|
|
34
|
+
static createTranslated(engine, type, reasonMap, variables, language, metadata) {
|
|
35
|
+
const key = reasonMap[type];
|
|
36
|
+
let message;
|
|
37
|
+
if (key && engine) {
|
|
38
|
+
// Try to translate the error message using the engine
|
|
39
|
+
message = engine.safeTranslate(key, variables, language);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Fallback to a basic English message
|
|
43
|
+
message = `Error: ${type}${metadata ? ` - ${JSON.stringify(metadata)}` : ''}`;
|
|
44
|
+
}
|
|
45
|
+
return new this(type, message, metadata);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BaseTypedError = BaseTypedError;
|
|
49
|
+
/**
|
|
50
|
+
* Legacy TypedError that ensures complete enum coverage (for backward compatibility)
|
|
51
|
+
*/
|
|
52
|
+
class TypedError extends Error {
|
|
53
|
+
type;
|
|
54
|
+
reasonMap;
|
|
55
|
+
language;
|
|
56
|
+
otherVars;
|
|
57
|
+
constructor(engine, type, reasonMap, language, otherVars) {
|
|
58
|
+
const key = reasonMap[type];
|
|
59
|
+
if (!key)
|
|
60
|
+
throw new Error(engine.translate(default_config_1.DefaultStringKey.Error_MissingTranslationKeyTemplate, { type }, language));
|
|
61
|
+
super(engine.translate(key, otherVars, language));
|
|
62
|
+
this.type = type;
|
|
63
|
+
this.reasonMap = reasonMap;
|
|
64
|
+
this.language = language;
|
|
65
|
+
this.otherVars = otherVars;
|
|
66
|
+
this.name = this.constructor.name;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.TypedError = TypedError;
|
|
70
|
+
/**
|
|
71
|
+
* Plugin-based TypedError that works with the new component registration system
|
|
72
|
+
*/
|
|
73
|
+
class PluginTypedError extends Error {
|
|
74
|
+
componentId;
|
|
75
|
+
type;
|
|
76
|
+
reasonMap;
|
|
77
|
+
language;
|
|
78
|
+
otherVars;
|
|
79
|
+
constructor(engine, componentId, type, reasonMap, language, otherVars) {
|
|
80
|
+
const key = reasonMap[type];
|
|
81
|
+
// If key is not found in the reason map, use core error message
|
|
82
|
+
if (!key) {
|
|
83
|
+
const errorMsg = engine.safeTranslate('core', core_string_key_1.CoreStringKey.Error_StringKeyNotFoundTemplate, {
|
|
84
|
+
stringKey: String(type),
|
|
85
|
+
componentId: componentId,
|
|
86
|
+
}, language);
|
|
87
|
+
throw new Error(errorMsg);
|
|
88
|
+
}
|
|
89
|
+
// Translate the error message using the component and string key
|
|
90
|
+
const translatedMessage = engine.safeTranslate(componentId, key, otherVars, language);
|
|
91
|
+
super(translatedMessage);
|
|
92
|
+
this.componentId = componentId;
|
|
93
|
+
this.type = type;
|
|
94
|
+
this.reasonMap = reasonMap;
|
|
95
|
+
this.language = language;
|
|
96
|
+
this.otherVars = otherVars;
|
|
97
|
+
this.name = this.constructor.name;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.PluginTypedError = PluginTypedError;
|
|
101
|
+
/**
|
|
102
|
+
* Core system TypedError using the core component strings
|
|
103
|
+
*/
|
|
104
|
+
class CoreTypedError extends Error {
|
|
105
|
+
type;
|
|
106
|
+
reasonMap;
|
|
107
|
+
language;
|
|
108
|
+
otherVars;
|
|
109
|
+
constructor(engine, type, reasonMap, language, otherVars) {
|
|
110
|
+
const key = reasonMap[type];
|
|
111
|
+
// If key is not found in the reason map, use a fallback error
|
|
112
|
+
if (!key) {
|
|
113
|
+
const errorMsg = engine.safeTranslate('core', core_string_key_1.CoreStringKey.Error_StringKeyNotFoundTemplate, {
|
|
114
|
+
stringKey: String(type),
|
|
115
|
+
componentId: 'core',
|
|
116
|
+
}, language);
|
|
117
|
+
throw new Error(errorMsg);
|
|
118
|
+
}
|
|
119
|
+
// Translate the error message using the core component
|
|
120
|
+
const translatedMessage = engine.safeTranslate('core', key, otherVars, language);
|
|
121
|
+
super(translatedMessage);
|
|
122
|
+
this.type = type;
|
|
123
|
+
this.reasonMap = reasonMap;
|
|
124
|
+
this.language = language;
|
|
125
|
+
this.otherVars = otherVars;
|
|
126
|
+
this.name = this.constructor.name;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.CoreTypedError = CoreTypedError;
|
|
130
|
+
/**
|
|
131
|
+
* Helper function to create a plugin-based TypedError with automatic engine detection
|
|
132
|
+
*/
|
|
133
|
+
function createPluginTypedError(componentId, type, reasonMap, otherVars, language, instanceKey) {
|
|
134
|
+
const engine = plugin_i18n_engine_1.PluginI18nEngine.getInstance(instanceKey);
|
|
135
|
+
return new (class extends PluginTypedError {
|
|
136
|
+
constructor() {
|
|
137
|
+
super(engine, componentId, type, reasonMap, language, otherVars);
|
|
138
|
+
}
|
|
139
|
+
})();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Helper function to create a core system TypedError with automatic engine detection
|
|
143
|
+
*/
|
|
144
|
+
function createCoreTypedError(type, reasonMap, otherVars, language, instanceKey) {
|
|
145
|
+
const engine = plugin_i18n_engine_1.PluginI18nEngine.getInstance(instanceKey);
|
|
146
|
+
return new (class extends CoreTypedError {
|
|
147
|
+
constructor() {
|
|
148
|
+
super(engine, type, reasonMap, language, otherVars);
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Create a simple error with translation support (generalized pattern from RegistryError)
|
|
154
|
+
*/
|
|
155
|
+
function createTranslatedError(engine, componentId, type, reasonMap, variables, language, metadata, errorName) {
|
|
156
|
+
const key = reasonMap[type];
|
|
157
|
+
let message;
|
|
158
|
+
if (key && engine) {
|
|
159
|
+
try {
|
|
160
|
+
// Try to translate the error message using the engine
|
|
161
|
+
message = engine.safeTranslate(key, variables, language);
|
|
162
|
+
}
|
|
163
|
+
catch (translationError) {
|
|
164
|
+
// Fallback if translation fails
|
|
165
|
+
message = `Error: ${type}${metadata ? ` - ${JSON.stringify(metadata)}` : ''}`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// Fallback to a basic English message
|
|
170
|
+
message = `Error: ${type}${metadata ? ` - ${JSON.stringify(metadata)}` : ''}`;
|
|
171
|
+
}
|
|
172
|
+
const error = new Error(message);
|
|
173
|
+
error.name = errorName || 'TranslatedError';
|
|
174
|
+
error.type = type;
|
|
175
|
+
error.metadata = metadata;
|
|
176
|
+
return error;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Example usage of the new plugin-based TypedError system
|
|
180
|
+
*/
|
|
181
|
+
// Example 1: Core system error using CoreStringKey
|
|
182
|
+
/*
|
|
183
|
+
enum DatabaseErrorType {
|
|
184
|
+
ConnectionFailed = 'connectionFailed',
|
|
185
|
+
QueryTimeout = 'queryTimeout',
|
|
186
|
+
AccessDenied = 'accessDenied'
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const coreErrorReasonMap: CompleteReasonMap<typeof DatabaseErrorType, CoreStringKey> = {
|
|
190
|
+
[DatabaseErrorType.ConnectionFailed]: CoreStringKey.Error_NetworkError,
|
|
191
|
+
[DatabaseErrorType.QueryTimeout]: CoreStringKey.Error_InternalServer,
|
|
192
|
+
[DatabaseErrorType.AccessDenied]: CoreStringKey.Error_AccessDenied
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
class DatabaseError extends CoreTypedError<typeof DatabaseErrorType> {
|
|
196
|
+
constructor(
|
|
197
|
+
engine: PluginI18nEngine<CoreLanguageCode>,
|
|
198
|
+
type: DatabaseErrorType,
|
|
199
|
+
otherVars?: Record<string, string | number>,
|
|
200
|
+
language?: CoreLanguage
|
|
201
|
+
) {
|
|
202
|
+
super(engine, type, coreErrorReasonMap, language, otherVars);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Usage:
|
|
207
|
+
// const engine = PluginI18nEngine.getInstance<string>();
|
|
208
|
+
// throw new DatabaseError(engine, DatabaseErrorType.ConnectionFailed);
|
|
209
|
+
*/
|
|
210
|
+
// Example 2: Custom component error with custom strings
|
|
211
|
+
/*
|
|
212
|
+
enum UserErrorType {
|
|
213
|
+
UserNotFound = 'userNotFound',
|
|
214
|
+
InvalidCredentials = 'invalidCredentials',
|
|
215
|
+
AccountLocked = 'accountLocked'
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
enum UserErrorStringKey {
|
|
219
|
+
UserNotFoundMessage = 'userNotFoundMessage',
|
|
220
|
+
InvalidCredentialsMessage = 'invalidCredentialsMessage',
|
|
221
|
+
AccountLockedMessage = 'accountLockedMessage'
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const userErrorReasonMap: CompleteReasonMap<typeof UserErrorType, UserErrorStringKey> = {
|
|
225
|
+
[UserErrorType.UserNotFound]: UserErrorStringKey.UserNotFoundMessage,
|
|
226
|
+
[UserErrorType.InvalidCredentials]: UserErrorStringKey.InvalidCredentialsMessage,
|
|
227
|
+
[UserErrorType.AccountLocked]: UserErrorStringKey.AccountLockedMessage
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
class UserError extends PluginTypedError<typeof UserErrorType, UserErrorStringKey, string> {
|
|
231
|
+
constructor(
|
|
232
|
+
engine: PluginI18nEngine<string>,
|
|
233
|
+
type: UserErrorType,
|
|
234
|
+
otherVars?: Record<string, string | number>,
|
|
235
|
+
language?: string
|
|
236
|
+
) {
|
|
237
|
+
super(engine, 'user-system', type, userErrorReasonMap, language, otherVars);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Usage:
|
|
242
|
+
// const engine = PluginI18nEngine.getInstance<string>();
|
|
243
|
+
// throw new UserError(engine, UserErrorType.UserNotFound, { username: 'john_doe' });
|
|
244
|
+
*/
|
|
245
|
+
// Example 3: Using helper functions for simpler error creation
|
|
246
|
+
/*
|
|
247
|
+
// Define your error types and mappings
|
|
248
|
+
enum ApiErrorType {
|
|
249
|
+
Timeout = 'timeout',
|
|
250
|
+
NotFound = 'notFound'
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const apiErrorMap: CompleteReasonMap<typeof ApiErrorType, CoreStringKey> = {
|
|
254
|
+
[ApiErrorType.Timeout]: CoreStringKey.Error_NetworkError,
|
|
255
|
+
[ApiErrorType.NotFound]: CoreStringKey.Error_NotFound
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Create errors using helper functions
|
|
259
|
+
function throwApiError(type: ApiErrorType, vars?: Record<string, string | number>) {
|
|
260
|
+
throw createCoreTypedError(type, apiErrorMap, vars);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Usage:
|
|
264
|
+
// throwApiError(ApiErrorType.NotFound, { resource: 'user' });
|
|
265
|
+
*/
|
|
266
|
+
// Export the type for external use (already exported above)
|
|
267
|
+
//# sourceMappingURL=typed-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-error.js","sourceRoot":"","sources":["../../../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G,UAAU,IAAI,GACtB,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAChD,EAAE,CAAC;QACL,CAAC;IACH,CAAC;SAAM,CAAC;QACN,sCAAsC;QACtC,OAAO,GAAG,UAAU,IAAI,GACtB,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAChD,EAAE,CAAC;IACL,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,GAAG,SAAS,IAAI,iBAAiB,CAAC;IAC3C,KAAa,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAEnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AAEH,mDAAmD;AACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE;AAEF,wDAAwD;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCE;AAEF,+DAA+D;AAC/D;;;;;;;;;;;;;;;;;;;EAmBE;AAEF,4DAA4D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CoreLanguageCode } from './core-i18n';
|
|
2
|
+
import { HandleableError } from './handleable';
|
|
3
|
+
import { IHandleable } from './i-handleable';
|
|
4
|
+
import { HandleableErrorOptions } from './i-handleable-error-options';
|
|
5
|
+
import { CompleteReasonMap, TranslationEngine } from './typed-error';
|
|
6
|
+
export declare class TypedHandleableError<TEnum extends Record<string, string>, TStringKey extends string, TLanguage extends CoreLanguageCode = CoreLanguageCode> extends HandleableError implements IHandleable {
|
|
7
|
+
readonly type: TEnum[keyof TEnum];
|
|
8
|
+
readonly reasonMap: CompleteReasonMap<TEnum, TStringKey>;
|
|
9
|
+
readonly engine: TranslationEngine<TStringKey>;
|
|
10
|
+
readonly language?: TLanguage;
|
|
11
|
+
readonly otherVars?: Record<string, string | number>;
|
|
12
|
+
constructor(type: TEnum[keyof TEnum], reasonMap: CompleteReasonMap<TEnum, TStringKey>, engine: TranslationEngine<TStringKey>, language?: TLanguage, otherVars?: Record<string, string | number>, options?: HandleableErrorOptions);
|
|
13
|
+
toJSON(): Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=typed-handleable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-handleable.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/typed-handleable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAErE,qBAAa,oBAAoB,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,SAAS,MAAM,EACzB,SAAS,SAAS,gBAAgB,GAAG,gBAAgB,CAEvD,SAAQ,eACR,YAAW,WAAW;IAEtB,SAAgB,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACzC,SAAgB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAChE,SAAgB,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACtD,SAAgB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;gBAG1D,IAAI,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,EACxB,SAAS,EAAE,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAC/C,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,EACrC,QAAQ,CAAC,EAAE,SAAS,EACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAC3C,OAAO,CAAC,EAAE,sBAAsB;IAkClB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOlD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TypedHandleableError = void 0;
|
|
4
|
+
const core_string_key_1 = require("./core-string-key");
|
|
5
|
+
const handleable_1 = require("./handleable");
|
|
6
|
+
const plugin_i18n_engine_1 = require("./plugin-i18n-engine");
|
|
7
|
+
class TypedHandleableError extends handleable_1.HandleableError {
|
|
8
|
+
type;
|
|
9
|
+
reasonMap;
|
|
10
|
+
engine;
|
|
11
|
+
language;
|
|
12
|
+
otherVars;
|
|
13
|
+
constructor(type, reasonMap, engine, language, otherVars, options) {
|
|
14
|
+
const key = reasonMap[type];
|
|
15
|
+
if (!key) {
|
|
16
|
+
const coreEngine = plugin_i18n_engine_1.PluginI18nEngine.getInstance();
|
|
17
|
+
throw new Error(coreEngine.translate('core', core_string_key_1.CoreStringKey.Error_MissingTranslationKeyTemplate, {
|
|
18
|
+
stringKey: key,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
let message = String(type);
|
|
22
|
+
try {
|
|
23
|
+
const keyString = key;
|
|
24
|
+
const translated = engine.translate(keyString, otherVars, language);
|
|
25
|
+
message = String(translated || type);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
message = String(type);
|
|
29
|
+
}
|
|
30
|
+
super(new Error(message), options);
|
|
31
|
+
this.type = type;
|
|
32
|
+
this.reasonMap = reasonMap;
|
|
33
|
+
this.language = language;
|
|
34
|
+
this.otherVars = otherVars;
|
|
35
|
+
this.engine = engine;
|
|
36
|
+
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
const baseJson = super.toJSON();
|
|
39
|
+
return {
|
|
40
|
+
...baseJson,
|
|
41
|
+
type: this.type,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.TypedHandleableError = TypedHandleableError;
|
|
46
|
+
//# sourceMappingURL=typed-handleable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-handleable.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/typed-handleable.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAClD,6CAA+C;AAG/C,6DAAwD;AAGxD,MAAa,oBAKX,SAAQ,4BAAe;IAGP,IAAI,CAAqB;IACzB,SAAS,CAAuC;IAChD,MAAM,CAAgC;IACtC,QAAQ,CAAa;IACrB,SAAS,CAAmC;IAE5D,YACE,IAAwB,EACxB,SAA+C,EAC/C,MAAqC,EACrC,QAAoB,EACpB,SAA2C,EAC3C,OAAgC;QAEhC,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,UAAU,GAAG,qCAAgB,CAAC,WAAW,EAAa,CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,UAAU,CAAC,SAAS,CAClB,MAAM,EACN,+BAAa,CAAC,mCAAmC,EACjD;gBACE,SAAS,EAAE,GAAa;aACzB,CACF,CACF,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,GAAW,MAAM,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,GAAiB,CAAC;YACpC,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpE,OAAO,GAAG,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAED,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEe,MAAM;QACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO;YACL,GAAG,QAAQ;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF;AA7DD,oDA6DC"}
|
|
@@ -1,146 +1,92 @@
|
|
|
1
1
|
import { ComponentDefinition } from './component-definition';
|
|
2
2
|
import { ComponentRegistration } from './component-registration';
|
|
3
3
|
import { LanguageDefinition } from './language-definition';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Standard language context spaces
|
|
7
6
|
*/
|
|
8
7
|
export type LanguageContextSpace = 'admin' | 'user';
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* Default currency code
|
|
12
10
|
*/
|
|
13
|
-
export const DefaultCurrencyCode: string
|
|
14
|
-
|
|
11
|
+
export declare const DefaultCurrencyCode: string;
|
|
15
12
|
/**
|
|
16
13
|
* Default timezone
|
|
17
14
|
*/
|
|
18
|
-
export const DefaultTimezone: string
|
|
19
|
-
|
|
15
|
+
export declare const DefaultTimezone: string;
|
|
20
16
|
/**
|
|
21
17
|
* Currency position type
|
|
22
18
|
*/
|
|
23
19
|
export type CurrencyPosition = 'prefix' | 'postfix' | 'infix';
|
|
24
|
-
|
|
25
20
|
/**
|
|
26
21
|
* Collection of localized strings for a specific language
|
|
27
22
|
*/
|
|
28
|
-
export type StringsCollection<TStringKey extends string> = Partial<
|
|
29
|
-
Record<TStringKey, string>
|
|
30
|
-
>;
|
|
31
|
-
|
|
23
|
+
export type StringsCollection<TStringKey extends string> = Partial<Record<TStringKey, string>>;
|
|
32
24
|
/**
|
|
33
25
|
* Mapping of languages to their respective string collections
|
|
34
26
|
*/
|
|
35
|
-
export type MasterStringsCollection<
|
|
36
|
-
TStringKey extends string,
|
|
37
|
-
TLanguage extends string,
|
|
38
|
-
> = Partial<Record<TLanguage, StringsCollection<TStringKey>>>;
|
|
39
|
-
|
|
27
|
+
export type MasterStringsCollection<TStringKey extends string, TLanguage extends string> = Partial<Record<TLanguage, StringsCollection<TStringKey>>>;
|
|
40
28
|
/**
|
|
41
29
|
* Mapping of language codes to their respective languages
|
|
42
30
|
*/
|
|
43
|
-
export type LanguageCodeCollection<TLanguage extends string> = Partial<
|
|
44
|
-
Record<TLanguage, string>
|
|
45
|
-
>;
|
|
46
|
-
|
|
31
|
+
export type LanguageCodeCollection<TLanguage extends string> = Partial<Record<TLanguage, string>>;
|
|
47
32
|
/**
|
|
48
33
|
* Mapping of enumeration values to their translations in multiple languages
|
|
49
34
|
*/
|
|
50
|
-
export type EnumTranslationMap<
|
|
51
|
-
TEnum extends string | number,
|
|
52
|
-
TLanguage extends string,
|
|
53
|
-
> = Partial<Record<TLanguage, Partial<Record<TEnum, string>>>>;
|
|
54
|
-
|
|
35
|
+
export type EnumTranslationMap<TEnum extends string | number, TLanguage extends string> = Partial<Record<TLanguage, Partial<Record<TEnum, string>>>>;
|
|
55
36
|
/**
|
|
56
37
|
* String collection for a specific language and component
|
|
57
38
|
*/
|
|
58
39
|
export type ComponentStrings<TStringKeys extends string> = {
|
|
59
|
-
|
|
40
|
+
[K in TStringKeys]: string;
|
|
60
41
|
};
|
|
61
|
-
|
|
62
42
|
/**
|
|
63
43
|
* Partial string collection (used during registration before validation)
|
|
64
44
|
*/
|
|
65
45
|
export type PartialComponentStrings<TStringKeys extends string> = {
|
|
66
|
-
|
|
46
|
+
[K in TStringKeys]?: string;
|
|
67
47
|
};
|
|
68
|
-
|
|
69
48
|
/**
|
|
70
49
|
* Language strings for a component across all registered languages
|
|
71
50
|
*/
|
|
72
|
-
export type ComponentLanguageStrings<
|
|
73
|
-
|
|
74
|
-
TLanguages extends string,
|
|
75
|
-
> = {
|
|
76
|
-
[L in TLanguages]: ComponentStrings<TStringKeys>;
|
|
51
|
+
export type ComponentLanguageStrings<TStringKeys extends string, TLanguages extends string> = {
|
|
52
|
+
[L in TLanguages]: ComponentStrings<TStringKeys>;
|
|
77
53
|
};
|
|
78
|
-
|
|
79
54
|
/**
|
|
80
55
|
* Partial language strings (used during registration before validation)
|
|
81
56
|
*/
|
|
82
|
-
export type PartialComponentLanguageStrings<
|
|
83
|
-
|
|
84
|
-
TLanguages extends string,
|
|
85
|
-
> = {
|
|
86
|
-
[L in TLanguages]?: PartialComponentStrings<TStringKeys>;
|
|
57
|
+
export type PartialComponentLanguageStrings<TStringKeys extends string, TLanguages extends string> = {
|
|
58
|
+
[L in TLanguages]?: PartialComponentStrings<TStringKeys>;
|
|
87
59
|
};
|
|
88
|
-
|
|
89
60
|
/**
|
|
90
61
|
* Generic translation type for any enumeration
|
|
91
62
|
*/
|
|
92
63
|
export type EnumTranslation<T extends string | number> = {
|
|
93
|
-
|
|
64
|
+
[K in T]: string;
|
|
94
65
|
};
|
|
95
|
-
|
|
96
66
|
/**
|
|
97
67
|
* Generic language translation type for any enumeration
|
|
98
68
|
*/
|
|
99
|
-
export type EnumLanguageTranslation<
|
|
100
|
-
|
|
101
|
-
TLanguage extends string = string,
|
|
102
|
-
> = Partial<{
|
|
103
|
-
[L in TLanguage]: EnumTranslation<T>;
|
|
69
|
+
export type EnumLanguageTranslation<T extends string | number, TLanguage extends string = string> = Partial<{
|
|
70
|
+
[L in TLanguage]: EnumTranslation<T>;
|
|
104
71
|
}>;
|
|
105
|
-
|
|
106
72
|
/**
|
|
107
73
|
* Type utility to extract string keys from a component definition
|
|
108
74
|
*/
|
|
109
|
-
export type ExtractStringKeys<T> = T extends ComponentDefinition<infer K>
|
|
110
|
-
? K
|
|
111
|
-
: never;
|
|
112
|
-
|
|
75
|
+
export type ExtractStringKeys<T> = T extends ComponentDefinition<infer K> ? K : never;
|
|
113
76
|
/**
|
|
114
77
|
* Type utility to extract languages from registry
|
|
115
78
|
*/
|
|
116
|
-
export type ExtractLanguages<T> = T extends LanguageDefinition
|
|
117
|
-
? T['id']
|
|
118
|
-
: never;
|
|
119
|
-
|
|
79
|
+
export type ExtractLanguages<T> = T extends LanguageDefinition ? T['id'] : never;
|
|
120
80
|
/**
|
|
121
81
|
* Type utility to create a strongly typed component registration
|
|
122
82
|
*/
|
|
123
|
-
export type CreateComponentRegistration<
|
|
124
|
-
TComponent extends ComponentDefinition<any>,
|
|
125
|
-
TLanguages extends string,
|
|
126
|
-
> = ComponentRegistration<ExtractStringKeys<TComponent>, TLanguages>;
|
|
127
|
-
|
|
83
|
+
export type CreateComponentRegistration<TComponent extends ComponentDefinition<any>, TLanguages extends string> = ComponentRegistration<ExtractStringKeys<TComponent>, TLanguages>;
|
|
128
84
|
/**
|
|
129
85
|
* Utility type to ensure all string keys are provided for all languages
|
|
130
86
|
*/
|
|
131
|
-
export type CompleteComponentStrings<
|
|
132
|
-
TStringKeys extends string,
|
|
133
|
-
TLanguages extends string,
|
|
134
|
-
> = ComponentLanguageStrings<TStringKeys, TLanguages>;
|
|
135
|
-
|
|
87
|
+
export type CompleteComponentStrings<TStringKeys extends string, TLanguages extends string> = ComponentLanguageStrings<TStringKeys, TLanguages>;
|
|
136
88
|
/**
|
|
137
89
|
* Helper function to create typed translations for an enumeration
|
|
138
90
|
*/
|
|
139
|
-
export function createTranslations<
|
|
140
|
-
|
|
141
|
-
TLanguage extends string,
|
|
142
|
-
>(
|
|
143
|
-
translations: EnumLanguageTranslation<T, TLanguage>,
|
|
144
|
-
): EnumLanguageTranslation<T, TLanguage> {
|
|
145
|
-
return translations;
|
|
146
|
-
}
|
|
91
|
+
export declare function createTranslations<T extends string | number, TLanguage extends string>(translations: EnumLanguageTranslation<T, TLanguage>): EnumLanguageTranslation<T, TLanguage>;
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAc,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAc,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,UAAU,SAAS,MAAM,IAAI,OAAO,CAChE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,CACjC,UAAU,SAAS,MAAM,EACzB,SAAS,SAAS,MAAM,IACtB,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAAC,SAAS,SAAS,MAAM,IAAI,OAAO,CACpE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAC5B,KAAK,SAAS,MAAM,GA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AC,CAAC,IAAI,CAAC,SAAS,kBAAkB,GAC1D,CAAC,CAAC,IAAI,CAAC,GACP,KAAK,CAAC;AAEV;;GAEG;AACH,MAAM,MAAM,2BAA2B,CACrC,UAAU,SAAS,mBAAmB,CAAC,GAAG,CAAC,EAC3C,UAAU,SAAS,MAAM,IACvB,qBAAqB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,wBAAwB,CAClC,WAAW,SAAS,MAAM,EAC1B,UAAU,SAAS,MAAM,IACvB,wBAAwB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEtD;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,SAAS,SAAS,MAAM,EAExB,YAAY,EAAE,uBAAuB,CAAC,CAAC,EAAE,SAAS,CAAC,GAClD,uBAAuB,CAAC,CAAC,EAAE,SAAS,CAAC,CAEvC"}
|
package/src/types.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultTimezone = exports.DefaultCurrencyCode = void 0;
|
|
4
|
+
exports.createTranslations = createTranslations;
|
|
5
|
+
/**
|
|
6
|
+
* Default currency code
|
|
7
|
+
*/
|
|
8
|
+
exports.DefaultCurrencyCode = 'USD';
|
|
9
|
+
/**
|
|
10
|
+
* Default timezone
|
|
11
|
+
*/
|
|
12
|
+
exports.DefaultTimezone = 'UTC';
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to create typed translations for an enumeration
|
|
15
|
+
*/
|
|
16
|
+
function createTranslations(translations) {
|
|
17
|
+
return translations;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
package/src/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/types.ts"],"names":[],"mappings":";;;AA0IA,gDAOC;AAxID;;GAEG;AACU,QAAA,mBAAmB,GAAW,KAAK,CAAC;AAEjD;;GAEG;AACU,QAAA,eAAe,GAAW,KAAK,CAAC;AAsH7C;;GAEG;AACH,SAAgB,kBAAkB,CAIhC,YAAmD;IAEnD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PluginI18nEngine } from './plugin-i18n-engine';
|
|
2
|
+
import { I18nEngine } from './i18n-engine';
|
|
3
|
+
/**
|
|
4
|
+
* Unified translator with explicit component/engine specification
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnifiedTranslator<TLanguage extends string = string> {
|
|
7
|
+
private sources;
|
|
8
|
+
private defaultLanguage;
|
|
9
|
+
private defaultSource?;
|
|
10
|
+
constructor(defaultLanguage: TLanguage);
|
|
11
|
+
/**
|
|
12
|
+
* Register a plugin component
|
|
13
|
+
*/
|
|
14
|
+
registerPlugin(id: string, engine: PluginI18nEngine<any>, componentId: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Register a legacy engine
|
|
17
|
+
*/
|
|
18
|
+
registerLegacy(id: string, engine: I18nEngine<any, any, any, any>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Set default source for unqualified keys
|
|
21
|
+
*/
|
|
22
|
+
setDefaultSource(id: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Translate with explicit source: 'source:key' or just 'key' (uses default)
|
|
25
|
+
*/
|
|
26
|
+
translate(key: string, vars?: Record<string, string | number>, language?: TLanguage): string;
|
|
27
|
+
setLanguage(language: TLanguage): void;
|
|
28
|
+
getLanguage(): TLanguage;
|
|
29
|
+
clearSources(): void;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=unified-translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-translator.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/unified-translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAe3C;;GAEG;AACH,qBAAa,iBAAiB,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM;IAC9D,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,aAAa,CAAC,CAAS;gBAEnB,eAAe,EAAE,SAAS;IAItC;;OAEG;IACH,cAAc,CACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAC7B,WAAW,EAAE,MAAM,GAClB,IAAI;IAKP;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;IAKxE;;OAEG;IACH,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAOlC;;OAEG;IACH,SAAS,CACP,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACtC,QAAQ,CAAC,EAAE,SAAS,GACnB,MAAM;IAkBT,WAAW,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAItC,WAAW,IAAI,SAAS;IAIxB,YAAY,IAAI,IAAI;CAIrB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnifiedTranslator = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Unified translator with explicit component/engine specification
|
|
6
|
+
*/
|
|
7
|
+
class UnifiedTranslator {
|
|
8
|
+
sources = new Map();
|
|
9
|
+
defaultLanguage;
|
|
10
|
+
defaultSource;
|
|
11
|
+
constructor(defaultLanguage) {
|
|
12
|
+
this.defaultLanguage = defaultLanguage;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Register a plugin component
|
|
16
|
+
*/
|
|
17
|
+
registerPlugin(id, engine, componentId) {
|
|
18
|
+
this.sources.set(id, { type: 'plugin', engine, componentId });
|
|
19
|
+
if (!this.defaultSource)
|
|
20
|
+
this.defaultSource = id;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register a legacy engine
|
|
24
|
+
*/
|
|
25
|
+
registerLegacy(id, engine) {
|
|
26
|
+
this.sources.set(id, { type: 'legacy', engine });
|
|
27
|
+
if (!this.defaultSource)
|
|
28
|
+
this.defaultSource = id;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Set default source for unqualified keys
|
|
32
|
+
*/
|
|
33
|
+
setDefaultSource(id) {
|
|
34
|
+
if (!this.sources.has(id)) {
|
|
35
|
+
throw new Error(`Source '${id}' not registered`);
|
|
36
|
+
}
|
|
37
|
+
this.defaultSource = id;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Translate with explicit source: 'source:key' or just 'key' (uses default)
|
|
41
|
+
*/
|
|
42
|
+
translate(key, vars, language) {
|
|
43
|
+
const lang = language || this.defaultLanguage;
|
|
44
|
+
const [sourceName, actualKey] = key.includes(':')
|
|
45
|
+
? key.split(':', 2)
|
|
46
|
+
: [this.defaultSource, key];
|
|
47
|
+
if (!sourceName)
|
|
48
|
+
return `[${key}]`;
|
|
49
|
+
const source = this.sources.get(sourceName);
|
|
50
|
+
if (!source)
|
|
51
|
+
return `[${key}]`;
|
|
52
|
+
if (source.type === 'plugin') {
|
|
53
|
+
return source.engine.safeTranslate(source.componentId, actualKey, vars, lang);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return source.engine.safeTranslate(actualKey, vars, lang);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
setLanguage(language) {
|
|
60
|
+
this.defaultLanguage = language;
|
|
61
|
+
}
|
|
62
|
+
getLanguage() {
|
|
63
|
+
return this.defaultLanguage;
|
|
64
|
+
}
|
|
65
|
+
clearSources() {
|
|
66
|
+
this.sources.clear();
|
|
67
|
+
this.defaultSource = undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.UnifiedTranslator = UnifiedTranslator;
|
|
71
|
+
//# sourceMappingURL=unified-translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-translator.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-i18n-lib/src/unified-translator.ts"],"names":[],"mappings":";;;AAgBA;;GAEG;AACH,MAAa,iBAAiB;IACpB,OAAO,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC/C,eAAe,CAAY;IAC3B,aAAa,CAAU;IAE/B,YAAY,eAA0B;QACpC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,cAAc,CACZ,EAAU,EACV,MAA6B,EAC7B,WAAmB;QAEnB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,EAAU,EAAE,MAAsC;QAC/D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,gBAAgB,CAAC,EAAU;QACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,WAA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