mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:56:29 +00:00
fix: update the locale file requires a reboot
This commit is contained in:
parent
88d1bdbefb
commit
aa6e753b35
@ -67,6 +67,9 @@ export class Locale {
|
|||||||
|
|
||||||
async getCacheResources(lang: string) {
|
async getCacheResources(lang: string) {
|
||||||
this.resourceCached.set(lang, true);
|
this.resourceCached.set(lang, true);
|
||||||
|
if (process.env.APP_ENV !== 'production') {
|
||||||
|
await this.cache.reset();
|
||||||
|
}
|
||||||
return await this.wrapCache(`resources:${lang}`, () => this.getResources(lang));
|
return await this.wrapCache(`resources:${lang}`, () => this.getResources(lang));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,10 @@ export const getResource = (packageName: string, lang: string, isPlugin = true)
|
|||||||
for (const prefix of prefixes) {
|
for (const prefix of prefixes) {
|
||||||
try {
|
try {
|
||||||
const file = `${packageName}/${prefix}/locale/${lang}`;
|
const file = `${packageName}/${prefix}/locale/${lang}`;
|
||||||
require.resolve(file);
|
const f = require.resolve(file);
|
||||||
|
if (process.env.APP_ENV !== 'production') {
|
||||||
|
delete require.cache[f];
|
||||||
|
}
|
||||||
const resource = requireModule(file);
|
const resource = requireModule(file);
|
||||||
resources.push(resource);
|
resources.push(resource);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user