opticore-translator 1.0.7 → 1.0.8
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 +1 -4
- package/dist/index.js +1 -4
- package/example/index.ts +0 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,6 @@ var TranslationLoader = class {
|
|
|
54
54
|
const filePath = import_path.default.join(directory, file);
|
|
55
55
|
try {
|
|
56
56
|
this.translations[locale] = JSON.parse(import_fs.default.readFileSync(filePath, "utf-8"));
|
|
57
|
-
this.loggerConfig.success("Translation Loaded", `Translations loaded for locale: ${locale}`);
|
|
58
57
|
} catch (error) {
|
|
59
58
|
this.loggerConfig.error(
|
|
60
59
|
error.message,
|
|
@@ -92,9 +91,7 @@ var TranslationLoader = class {
|
|
|
92
91
|
if (Array.isArray(value)) {
|
|
93
92
|
return value.join(", ");
|
|
94
93
|
}
|
|
95
|
-
|
|
96
|
-
this.loggerConfig.info("Formatting message", `Replacing {${key}} with: ${formattedValue}`);
|
|
97
|
-
return formattedValue;
|
|
94
|
+
return value !== void 0 ? value.toString() : `{${key}}`;
|
|
98
95
|
});
|
|
99
96
|
}
|
|
100
97
|
};
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var TranslationLoader = class {
|
|
|
18
18
|
const filePath = path.join(directory, file);
|
|
19
19
|
try {
|
|
20
20
|
this.translations[locale] = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
21
|
-
this.loggerConfig.success("Translation Loaded", `Translations loaded for locale: ${locale}`);
|
|
22
21
|
} catch (error) {
|
|
23
22
|
this.loggerConfig.error(
|
|
24
23
|
error.message,
|
|
@@ -56,9 +55,7 @@ var TranslationLoader = class {
|
|
|
56
55
|
if (Array.isArray(value)) {
|
|
57
56
|
return value.join(", ");
|
|
58
57
|
}
|
|
59
|
-
|
|
60
|
-
this.loggerConfig.info("Formatting message", `Replacing {${key}} with: ${formattedValue}`);
|
|
61
|
-
return formattedValue;
|
|
58
|
+
return value !== void 0 ? value.toString() : `{${key}}`;
|
|
62
59
|
});
|
|
63
60
|
}
|
|
64
61
|
};
|
package/example/index.ts
CHANGED
|
@@ -3,8 +3,6 @@ import path from "path";
|
|
|
3
3
|
|
|
4
4
|
((): void => {
|
|
5
5
|
TranslationLoader.loadTranslations(path.join('src', 'utils', 'translations'));
|
|
6
|
-
//const msg: string = TranslationLoader.t("mongoServerError", "en");
|
|
7
|
-
|
|
8
6
|
console.log("path is :", path.join(process.cwd(), 'src', 'utils', 'translations'));
|
|
9
7
|
console.log("mongoServerError is :", TranslationLoader.t("mongoServerError", "en", { dbHost: '127.0.0.1' }));
|
|
10
8
|
})();
|