This commit is contained in:
syuilo 2020-07-24 22:30:23 +09:00
parent d3135ed9d3
commit b3b7be2949
2 changed files with 16 additions and 14 deletions

View File

@ -81,10 +81,6 @@ const html = document.documentElement;
html.setAttribute('lang', lang);
//#endregion
const i18n = createI18n({
legacy: true,
});
//#region Fetch user
const signout = () => {
store.dispatch('logout');
@ -158,17 +154,24 @@ app.use(store);
app.use(router);
app.use(VueHotkey);
app.use(VAnimateCss);
app.use(i18n);
app.component('fa', FontAwesomeIcon);
//#region Fetch locale data
/*await count(clientDb.i18n).then(async n => {
if (n === 0) return setI18nContexts(lang, version, i18n);
if ((await get('_version_', clientDb.i18n) !== version)) return setI18nContexts(lang, version, i18n, true);
//#region Init i18n
const locale = await count(clientDb.i18n).then(async n => {
if (n === 0) return await setI18nContexts(lang, version, i18n);
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(lang, version, i18n, true);
i18n.locale = lang;
i18n.setLocaleMessage(lang, await getLocale());
});*/
return await getLocale();
});
const i18n = createI18n({
legacy: true,
sync: false,
locale: lang,
messages: { [lang]: locale }
});
app.use(i18n);
//#endregion
widgets(app);

View File

@ -11,7 +11,6 @@ export function setI18nContexts(lang: string, version: string, i18n: I18n, clear
.then(locale => {
const flatLocaleEntries = deepEntries(locale, delimitEntry) as [string, string][];
bulkSet(flatLocaleEntries, clientDb.i18n);
i18n.locale = lang;
i18n.setLocaleMessage(lang, Object.fromEntries(flatLocaleEntries));
return Object.fromEntries(flatLocaleEntries);
});
}