💄 Nicer design for language swtitcher

This commit is contained in:
Alicia Sykes 2021-09-11 01:35:02 +01:00
parent ad069bdf30
commit 412d341b23
1 changed files with 5 additions and 1 deletions

View File

@ -26,8 +26,9 @@
<script>
import Button from '@/components/FormElements/Button';
import { languages } from '@/utils/languages';
import SaveConfigIcon from '@/assets/interface-icons/save-config.svg';
import ErrorHandler from '@/utils/ErrorHandler';
import { languages } from '@/utils/languages';
import { localStorageKeys, modalNames } from '@/utils/defaults';
export default {
@ -62,6 +63,8 @@ export default {
applyLanguageLocally() {
if (this.language && this.language.code) {
this.$i18n.locale = this.language.code;
} else {
ErrorHandler('Error applying language, it\'s config may be missing of incomplete');
}
},
/* Save language to local storage, show success msg and close modal */
@ -76,6 +79,7 @@ export default {
this.$modal.hide(this.modalName);
} else {
this.$toasted.show('Unable to update language', { className: 'toast-error' });
ErrorHandler('Unable to apply language');
}
},
/* Gets the users current language from local storage */