mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04: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
@ -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`);
|
||||||
|
|
||||||
@ -42,3 +34,5 @@ export function loadLanguageAsync(lang) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
return Promise.resolve(setI18nLanguage(lang))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user