mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 12:18:15 +08: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) {
|
||||
this.resourceCached.set(lang, true);
|
||||
if (process.env.APP_ENV !== 'production') {
|
||||
await this.cache.reset();
|
||||
}
|
||||
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) {
|
||||
try {
|
||||
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);
|
||||
resources.push(resource);
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user