wip
This commit is contained in:
parent
638e96d863
commit
182c291e33
|
@ -158,8 +158,8 @@ app.component('fa', FontAwesomeIcon);
|
||||||
|
|
||||||
//#region Init i18n
|
//#region Init i18n
|
||||||
const locale = await count(clientDb.i18n).then(async n => {
|
const locale = await count(clientDb.i18n).then(async n => {
|
||||||
if (n === 0) return await setI18nContexts(lang, version, i18n);
|
if (n === 0) return await setI18nContexts(lang, version);
|
||||||
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(lang, version, i18n, true);
|
if ((await get('_version_', clientDb.i18n) !== version)) return await setI18nContexts(lang, version, true);
|
||||||
|
|
||||||
return await getLocale();
|
return await getLocale();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { I18n } from 'vue-i18n';
|
|
||||||
import { clientDb, clear, bulkSet } from '../db';
|
import { clientDb, clear, bulkSet } from '../db';
|
||||||
import { deepEntries, delimitEntry } from 'deep-entries';
|
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([
|
return Promise.all([
|
||||||
cleardb ? clear(clientDb.i18n) : Promise.resolve(),
|
cleardb ? clear(clientDb.i18n) : Promise.resolve(),
|
||||||
fetch(`/assets/locales/${lang}.${version}.json`)
|
fetch(`/assets/locales/${lang}.${version}.json`)
|
||||||
|
|
Loading…
Reference in New Issue