Dynamically set dashboard language when profile language changes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<script setup>
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
const { t } = useI18n();
|
||||
|
||||
import { ref, onMounted, useTemplateRef } from 'vue';
|
||||
import { Button, SingleSelect, Dialog, InputDialog, TextInput, InputGroup, FormGroup } from '@cloudron/pankow';
|
||||
import { setLanguage } from '../i18n.js';
|
||||
import { TOKEN_TYPES } from '../constants.js';
|
||||
import NotificationSettings from '../components/NotificationSettings.vue';
|
||||
import AppPasswords from '../components/AppPasswords.vue';
|
||||
@@ -40,11 +40,10 @@ const disableTwoFADialog = useTemplateRef('disableTwoFADialog');
|
||||
const languages = ref([]);
|
||||
const language = ref('');
|
||||
async function onSelectLanguage(lang) {
|
||||
window.localStorage.NG_TRANSLATE_LANG_KEY = lang;
|
||||
|
||||
const error = await profileModel.setLanguage(lang);
|
||||
if (error) console.error('Failed to set language', error);
|
||||
else window.location.reload();
|
||||
if (error) return console.error('Failed to set language', error);
|
||||
|
||||
await setLanguage(lang);
|
||||
}
|
||||
|
||||
async function refreshProfile() {
|
||||
|
||||
Reference in New Issue
Block a user