This commit is contained in:
syuilo 2020-08-22 05:56:33 +09:00
parent 638e96d863
commit 182c291e33
2 changed files with 3 additions and 4 deletions

View File

@ -158,8 +158,8 @@ app.component('fa', FontAwesomeIcon);
//#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);
if (n === 0) return await setI18nContexts(lang, version);
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(lang, version, true);
return await getLocale();
});

View File

@ -1,8 +1,7 @@
import { I18n } from 'vue-i18n';
import { clientDb, clear, bulkSet } from '../db';
import { deepEntries, delimitEntry } from 'deep-entries';
export function setI18nContexts(lang: string, version: string, i18n: I18n, cleardb = false) {
export function setI18nContexts(lang: string, version: string, cleardb = false) {
return Promise.all([
cleardb ? clear(clientDb.i18n) : Promise.resolve(),
fetch(`/assets/locales/${lang}.${version}.json`)