mirror of https://github.com/Lissy93/dashy.git
💄 Nicer design for language swtitcher
This commit is contained in:
parent
ad069bdf30
commit
412d341b23
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import { languages } from '@/utils/languages';
|
|
||||||
import SaveConfigIcon from '@/assets/interface-icons/save-config.svg';
|
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';
|
import { localStorageKeys, modalNames } from '@/utils/defaults';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -62,6 +63,8 @@ export default {
|
||||||
applyLanguageLocally() {
|
applyLanguageLocally() {
|
||||||
if (this.language && this.language.code) {
|
if (this.language && this.language.code) {
|
||||||
this.$i18n.locale = 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 */
|
/* Save language to local storage, show success msg and close modal */
|
||||||
|
@ -76,6 +79,7 @@ export default {
|
||||||
this.$modal.hide(this.modalName);
|
this.$modal.hide(this.modalName);
|
||||||
} else {
|
} else {
|
||||||
this.$toasted.show('Unable to update language', { className: 'toast-error' });
|
this.$toasted.show('Unable to update language', { className: 'toast-error' });
|
||||||
|
ErrorHandler('Unable to apply language');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* Gets the users current language from local storage */
|
/* Gets the users current language from local storage */
|
||||||
|
|
Loading…
Reference in New Issue