@mostfeatured/dbi 0.1.22 → 0.1.23
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/package.json
CHANGED
|
@@ -40,15 +40,19 @@ export class DBILocale<TNamespace extends NamespaceEnums> {
|
|
|
40
40
|
return _.get(this._data as any, path) as string || null;
|
|
41
41
|
}
|
|
42
42
|
format(path: string, ...args: any[]): string {
|
|
43
|
-
|
|
43
|
+
let value = this.get(path);
|
|
44
44
|
if (!value) {
|
|
45
45
|
const defaultLocale = this.dbi.locale(this.dbi.config.defaults.locale.name);
|
|
46
46
|
if (!defaultLocale) return this.dbi.config.defaults.locale.invalidPath({
|
|
47
47
|
locale: this,
|
|
48
48
|
path,
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
value = defaultLocale.get(path);
|
|
51
51
|
}
|
|
52
|
+
if (!value) return this.dbi.config.defaults.locale.invalidPath({
|
|
53
|
+
locale: this,
|
|
54
|
+
path,
|
|
55
|
+
});
|
|
52
56
|
return stuffs.mapReplace(value, args.map((t, i) => [new RegExp(`\\{${i}(;[^}]+)?\\}`, "g"), t]));
|
|
53
57
|
}
|
|
54
58
|
}
|