@digitaldefiance/i18n-lib 1.2.2 → 1.2.3
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 +5 -0
- package/dist/i18n-engine.d.ts +1 -1
- package/dist/translation-engine.d.ts +1 -1
- package/dist/typed-error.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1059,6 +1059,11 @@ Part of the DigitalBurnbag project - a secure file sharing and automated protoco
|
|
|
1059
1059
|
|
|
1060
1060
|
## ChangeLog
|
|
1061
1061
|
|
|
1062
|
+
### Version 1.2.3
|
|
1063
|
+
|
|
1064
|
+
- Thu Oct 23 2025 18:50:00 GMT-0700 (Pacific Daylight Time)
|
|
1065
|
+
- Minor update to fix safeTranslate being private
|
|
1066
|
+
|
|
1062
1067
|
### Version 1.2.2
|
|
1063
1068
|
|
|
1064
1069
|
- Thu Oct 23 2025 18:40:00 GMT-0700 (Pacific Daylight Time)
|
package/dist/i18n-engine.d.ts
CHANGED
|
@@ -112,7 +112,7 @@ export declare class I18nEngine<TStringKey extends string, TLanguage extends str
|
|
|
112
112
|
* @param language The language to translate to
|
|
113
113
|
* @returns The translated string or the key if translation fails
|
|
114
114
|
*/
|
|
115
|
-
|
|
115
|
+
safeTranslate(key: TStringKey, vars?: Record<string, string | number>, language?: TLanguage): string;
|
|
116
116
|
/**
|
|
117
117
|
* Retrieves the string for the given language and key, throwing an error if not found.
|
|
118
118
|
* @param language The language to get the string for
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export interface TranslationEngine<TStringKey extends string = string> {
|
|
6
6
|
translate: (key: TStringKey, vars?: Record<string, string | number>, lang?: any) => string;
|
|
7
|
-
safeTranslate: (
|
|
7
|
+
safeTranslate: (key: TStringKey, vars?: Record<string, string | number>, lang?: any) => string;
|
|
8
8
|
}
|
package/dist/typed-error.js
CHANGED
|
@@ -32,7 +32,7 @@ class BaseTypedError extends Error {
|
|
|
32
32
|
let message;
|
|
33
33
|
if (key && engine) {
|
|
34
34
|
// Try to translate the error message using the engine
|
|
35
|
-
message = engine.safeTranslate(
|
|
35
|
+
message = engine.safeTranslate(key, variables, language);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
// Fallback to a basic English message
|
|
@@ -141,7 +141,7 @@ function createTranslatedError(engine, componentId, type, reasonMap, variables,
|
|
|
141
141
|
if (key && engine) {
|
|
142
142
|
try {
|
|
143
143
|
// Try to translate the error message using the engine
|
|
144
|
-
message = engine.safeTranslate(
|
|
144
|
+
message = engine.safeTranslate(key, variables, language);
|
|
145
145
|
}
|
|
146
146
|
catch (translationError) {
|
|
147
147
|
// Fallback if translation fails
|