mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-07 06:25:21 +02:00
Fix en-US language not being loaded (#574)
VueI18n defaults to en-US when no language is specified, which prevented en-US messages from being loaded
This commit is contained in:
parent
4109d02a39
commit
3714baf5d6
1 changed files with 13 additions and 19 deletions
|
@ -20,16 +20,8 @@ function setI18nLanguage (lang) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadLanguageAsync(lang) {
|
export function loadLanguageAsync(lang) {
|
||||||
// If the same language
|
|
||||||
if (i18n.locale === lang) {
|
|
||||||
return Promise.resolve(setI18nLanguage(lang))
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the language was already loaded
|
|
||||||
if (loadedLanguages.includes(lang)) {
|
|
||||||
return Promise.resolve(setI18nLanguage(lang))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ( ! loadedLanguages.includes(lang)) {
|
||||||
const messages = import(`./locales/messages/${lang}.json`);
|
const messages = import(`./locales/messages/${lang}.json`);
|
||||||
const dateTimeFormats = import(`./locales/dateTimeFormats/${lang}.json`);
|
const dateTimeFormats = import(`./locales/dateTimeFormats/${lang}.json`);
|
||||||
|
|
||||||
|
@ -41,4 +33,6 @@ export function loadLanguageAsync(lang) {
|
||||||
return setI18nLanguage(lang)
|
return setI18nLanguage(lang)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
return Promise.resolve(setI18nLanguage(lang))
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue