From 182c291e337a7d2c1efd501b34229a9dfcb0933c Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 22 Aug 2020 05:56:33 +0900 Subject: [PATCH] wip --- src/client/init.ts | 4 ++-- src/client/scripts/set-i18n-contexts.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client/init.ts b/src/client/init.ts index 4083fe501a..1a1ffb36f4 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -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(); }); diff --git a/src/client/scripts/set-i18n-contexts.ts b/src/client/scripts/set-i18n-contexts.ts index de3d3de1bf..6014957361 100644 --- a/src/client/scripts/set-i18n-contexts.ts +++ b/src/client/scripts/set-i18n-contexts.ts @@ -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`)