opticore-translator 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -68,16 +68,16 @@ var TranslationLoader = class {
|
|
|
68
68
|
/**
|
|
69
69
|
*
|
|
70
70
|
* @param key
|
|
71
|
-
* @param
|
|
71
|
+
* @param localeLanguage
|
|
72
72
|
* @param loggerConfig
|
|
73
73
|
* @param params
|
|
74
74
|
*
|
|
75
75
|
* using example :
|
|
76
76
|
* const errorMessage = TranslationLoader.t('mongoServerError', 'en', { dbHost: '127.0.0.1' });
|
|
77
77
|
*/
|
|
78
|
-
static t(key,
|
|
78
|
+
static t(key, localeLanguage, loggerConfig, params = {}) {
|
|
79
79
|
var _a;
|
|
80
|
-
const localeKey = `message.translation.${
|
|
80
|
+
const localeKey = `message.translation.${localeLanguage}`;
|
|
81
81
|
const message = ((_a = this.translations[localeKey]) == null ? void 0 : _a[key]) || key;
|
|
82
82
|
return this.formatMessage(message, loggerConfig, params);
|
|
83
83
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,14 +11,14 @@ declare class TranslationLoader {
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
* @param key
|
|
14
|
-
* @param
|
|
14
|
+
* @param localeLanguage
|
|
15
15
|
* @param loggerConfig
|
|
16
16
|
* @param params
|
|
17
17
|
*
|
|
18
18
|
* using example :
|
|
19
19
|
* const errorMessage = TranslationLoader.t('mongoServerError', 'en', { dbHost: '127.0.0.1' });
|
|
20
20
|
*/
|
|
21
|
-
static t(key: string,
|
|
21
|
+
static t(key: string, localeLanguage: string, loggerConfig: LoggerCore, params?: Record<any, any>): string;
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @param template
|
package/dist/index.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ declare class TranslationLoader {
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
13
|
* @param key
|
|
14
|
-
* @param
|
|
14
|
+
* @param localeLanguage
|
|
15
15
|
* @param loggerConfig
|
|
16
16
|
* @param params
|
|
17
17
|
*
|
|
18
18
|
* using example :
|
|
19
19
|
* const errorMessage = TranslationLoader.t('mongoServerError', 'en', { dbHost: '127.0.0.1' });
|
|
20
20
|
*/
|
|
21
|
-
static t(key: string,
|
|
21
|
+
static t(key: string, localeLanguage: string, loggerConfig: LoggerCore, params?: Record<any, any>): string;
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @param template
|
package/dist/index.js
CHANGED
|
@@ -32,16 +32,16 @@ var TranslationLoader = class {
|
|
|
32
32
|
/**
|
|
33
33
|
*
|
|
34
34
|
* @param key
|
|
35
|
-
* @param
|
|
35
|
+
* @param localeLanguage
|
|
36
36
|
* @param loggerConfig
|
|
37
37
|
* @param params
|
|
38
38
|
*
|
|
39
39
|
* using example :
|
|
40
40
|
* const errorMessage = TranslationLoader.t('mongoServerError', 'en', { dbHost: '127.0.0.1' });
|
|
41
41
|
*/
|
|
42
|
-
static t(key,
|
|
42
|
+
static t(key, localeLanguage, loggerConfig, params = {}) {
|
|
43
43
|
var _a;
|
|
44
|
-
const localeKey = `message.translation.${
|
|
44
|
+
const localeKey = `message.translation.${localeLanguage}`;
|
|
45
45
|
const message = ((_a = this.translations[localeKey]) == null ? void 0 : _a[key]) || key;
|
|
46
46
|
return this.formatMessage(message, loggerConfig, params);
|
|
47
47
|
}
|