@adminforth/i18n 1.0.5 → 1.0.7
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.js +6 -0
- package/index.ts +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -398,6 +398,9 @@ ${JSON.stringify(strings.reduce((acc, s) => {
|
|
|
398
398
|
if (exists) {
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
|
+
if (!key) {
|
|
402
|
+
throw new Error(`Faced an empty key in Fronted messages, file ${file}`);
|
|
403
|
+
}
|
|
401
404
|
const record = Object.assign({ [this.enFieldName]: key, [this.options.categoryFieldName]: category }, (this.options.sourceFieldName ? { [this.options.sourceFieldName]: file } : {}));
|
|
402
405
|
try {
|
|
403
406
|
yield adminforth.resource(this.resourceConfig.resourceId).create(record);
|
|
@@ -456,6 +459,9 @@ ${JSON.stringify(strings.reduce((acc, s) => {
|
|
|
456
459
|
// in this plugin we will use plugin to fill the database with missing language messages
|
|
457
460
|
this.tryProcessAndWatch(adminforth);
|
|
458
461
|
adminforth.tr = (msg, category, lang, params) => __awaiter(this, void 0, void 0, function* () {
|
|
462
|
+
if (!msg) {
|
|
463
|
+
return msg;
|
|
464
|
+
}
|
|
459
465
|
// console.log('🪲tr', msg, category, lang);
|
|
460
466
|
// if lang is not supported , throw
|
|
461
467
|
if (!this.options.supportedLanguages.includes(lang)) {
|
package/index.ts
CHANGED
|
@@ -475,6 +475,9 @@ ${
|
|
|
475
475
|
if (exists) {
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
+
if (!key) {
|
|
479
|
+
throw new Error(`Faced an empty key in Fronted messages, file ${file}`);
|
|
480
|
+
}
|
|
478
481
|
const record = {
|
|
479
482
|
[this.enFieldName]: key,
|
|
480
483
|
[this.options.categoryFieldName]: category,
|
|
@@ -541,7 +544,10 @@ ${
|
|
|
541
544
|
// in this plugin we will use plugin to fill the database with missing language messages
|
|
542
545
|
this.tryProcessAndWatch(adminforth);
|
|
543
546
|
|
|
544
|
-
adminforth.tr = async (msg: string, category: string, lang: string, params): Promise<string> => {
|
|
547
|
+
adminforth.tr = async (msg: string | null | undefined, category: string, lang: string, params): Promise<string> => {
|
|
548
|
+
if (!msg) {
|
|
549
|
+
return msg;
|
|
550
|
+
}
|
|
545
551
|
// console.log('🪲tr', msg, category, lang);
|
|
546
552
|
|
|
547
553
|
// if lang is not supported , throw
|