mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
fix i18n message no fallback
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n';
|
||||||
import { getLocalizedStrings, languageCodes } from '../localization';
|
|
||||||
|
import { getLocalizedStrings } from '../localization';
|
||||||
|
|
||||||
|
const FALLBACK_LOCALE = 'en';
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: 'en',
|
locale: FALLBACK_LOCALE,
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: FALLBACK_LOCALE,
|
||||||
legacy: false,
|
legacy: false,
|
||||||
globalInjection: false,
|
globalInjection: false,
|
||||||
missingWarn: false,
|
missingWarn: false,
|
||||||
@@ -12,8 +15,13 @@ const i18n = createI18n({
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function loadLocalizedStrings(code) {
|
async function loadLocalizedStrings(code) {
|
||||||
const messages = await getLocalizedStrings(code);
|
const localesToLoad =
|
||||||
i18n.global.setLocaleMessage(code, messages);
|
code === FALLBACK_LOCALE ? [FALLBACK_LOCALE] : [FALLBACK_LOCALE, code];
|
||||||
|
|
||||||
|
for (const locale of localesToLoad) {
|
||||||
|
const messages = await getLocalizedStrings(locale);
|
||||||
|
i18n.global.setLocaleMessage(locale, messages);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateLocalizedStrings() {
|
async function updateLocalizedStrings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user