fix(lm): texts update hook after collection update (#3151)
* fix(lm): texts update hook after collection update * fix: validate language * fix: typo
This commit is contained in:
parent
3b324f31a2
commit
e0e91c2c95
@ -3,6 +3,7 @@ import dayjs from 'dayjs';
|
||||
import { loadConstrueLocale } from '../../antd-config-provider/loadConstrueLocale';
|
||||
import { Plugin } from '../../application/Plugin';
|
||||
import { dayjsLocale } from '../../locale';
|
||||
import { setValidateLanguage } from '@formily/validator';
|
||||
|
||||
export class LocalePlugin extends Plugin {
|
||||
locales: any = {};
|
||||
@ -27,6 +28,7 @@ export class LocalePlugin extends Plugin {
|
||||
Object.keys(data?.data?.resources || {}).forEach((key) => {
|
||||
this.app.i18n.addResources(data?.data?.lang, key, data?.data?.resources[key] || {});
|
||||
});
|
||||
setValidateLanguage(data?.data?.lang);
|
||||
loadConstrueLocale(data?.data);
|
||||
const dayjsLang = dayjsLocale[data?.data?.lang] || 'en';
|
||||
await import(`dayjs/locale/${dayjsLang}`);
|
||||
|
@ -33,7 +33,6 @@ export const useLanguageSettings = () => {
|
||||
},
|
||||
});
|
||||
api.auth.setLocale(lang);
|
||||
await i18n.changeLanguage(lang);
|
||||
window.location.reload();
|
||||
}}
|
||||
/>
|
||||
|
@ -96,7 +96,7 @@ export class LocalizationManagementPlugin extends Plugin {
|
||||
this.db
|
||||
.getModel('localizationTexts')
|
||||
.bulkCreate(
|
||||
texts.map((text) => ({
|
||||
texts.map(({ text, module }) => ({
|
||||
module,
|
||||
text,
|
||||
})),
|
||||
|
Loading…
Reference in New Issue
Block a user