diff --git a/README.md b/README.md index c17bfdae..011e4621 100644 --- a/README.md +++ b/README.md @@ -57,16 +57,16 @@ Html ### Features - Multi adapter/storage (see https://github.com/thephpleague/flysystem) - File and folder operations - - Create a new file - - Create a new folder - - Rename - - Delete + - Create a new file + - Create a new folder + - Rename + - Delete - Archive (zip) - Unarchive (unzip) - Text editing - Image Crop Tool - Upload / Download files - - Search (deep based on current folder) + - Search (deep based on current folder) - Nice UI - Context Menu - Breadcrumb links diff --git a/src/composables/useI18n.js b/src/composables/useI18n.js index e48111ff..4bc55994 100644 --- a/src/composables/useI18n.js +++ b/src/composables/useI18n.js @@ -11,16 +11,21 @@ export function useI18n(id, locale, emitter) { const {getStore, setStore} = useStorage(id); const translations = ref({}); - const changeLocale = (locale) => { + const changeLocale = (locale, defaultLocale = "en") => { loadLocale(locale).then((i18n) => { translations.value = i18n; setStore('locale', locale); setStore('translations', i18n); emitter.emit('vf-toast-push', {label: 'The language is set to ' + locale}); }).catch(e => { - emitter.emit('vf-toast-push', {label: 'The selected locale is not yet supported!', type:'error'}); - changeLocale('en'); - }); + .catch((e) => { + if (defaultLocale) { + emitter.emit('vf-toast-push', {label: 'The selected locale is not yet supported!', type:'error'}); + changeLocale(defaultLocale, null); + } else { + emitter.emit("vf-toast-push", {label: "Locale cannot be loaded!", type: "error"}); + } + }); }; if (!getStore('locale')) {