diff options
Diffstat (limited to 'src/client/pages/preferences/index.vue')
| -rw-r--r-- | src/client/pages/preferences/index.vue | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/client/pages/preferences/index.vue b/src/client/pages/preferences/index.vue index 9f4bb67956..14d22bf02d 100644 --- a/src/client/pages/preferences/index.vue +++ b/src/client/pages/preferences/index.vue @@ -99,8 +99,8 @@ import MkRadio from '../../components/ui/radio.vue'; import MkRange from '../../components/ui/range.vue'; import XTheme from './theme.vue'; import XSidebar from './sidebar.vue'; -import i18n from '../../i18n'; import { langs } from '../../config'; +import { clientDb, set } from '../../db'; const sounds = [ null, @@ -120,8 +120,6 @@ const sounds = [ ]; export default Vue.extend({ - i18n, - metaInfo() { return { title: this.$t('settings') as string @@ -228,9 +226,23 @@ export default Vue.extend({ watch: { lang() { + const dialog = this.$root.dialog({ + type: 'waiting', + iconOnly: true + }); + localStorage.setItem('lang', this.lang); - localStorage.removeItem('locale'); - location.reload(); + + return set('_version_', `changeLang-${(new Date()).toJSON()}`, clientDb.i18n) + .then(() => location.reload()) + .catch(() => { + dialog.close(); + this.$root.dialog({ + type: 'error', + iconOnly: true, + autoClose: true + }); + }); }, fontSize() { |