Dynamically set dashboard language when profile language changes

This commit is contained in:
Johannes Zellner
2025-07-10 13:47:43 +02:00
parent 820aeee659
commit 01b1f7529e
3 changed files with 27 additions and 7 deletions
+5 -6
View File
@@ -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() {