mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
Dynamically load language files (#446)
This commit is contained in:
committed by
GitHub
parent
32f7bc053a
commit
a40bf5840d
@@ -27,6 +27,8 @@
|
||||
|
||||
<BaseButton
|
||||
v-show="!isFetchingInitialData"
|
||||
:loading="isChangingLanguage"
|
||||
:disabled="isChangingLanguage"
|
||||
@click="next"
|
||||
>
|
||||
{{ $t('wizard.continue') }}
|
||||
@@ -43,12 +45,11 @@
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useInstallationStore } from '@/scripts/admin/stores/installation.js'
|
||||
|
||||
const { global } = window.i18n
|
||||
|
||||
const emit = defineEmits(['next'])
|
||||
|
||||
let isFetchingInitialData = ref(false)
|
||||
let isSaving = ref(false)
|
||||
let isChangingLanguage = ref(false)
|
||||
let languages = ref([])
|
||||
let currentLanguage = 'en'
|
||||
|
||||
@@ -75,11 +76,19 @@ function next() {
|
||||
isSaving.value = false
|
||||
}
|
||||
|
||||
function changeLanguage(event){
|
||||
if(typeof global.locale !== 'string') {
|
||||
global.locale.value = event
|
||||
async function changeLanguage(event) {
|
||||
if (!event) return
|
||||
|
||||
isChangingLanguage.value = true
|
||||
|
||||
try {
|
||||
// Dynamically load the selected language
|
||||
await window.loadLanguage(event)
|
||||
currentLanguage.value = event
|
||||
} catch (error) {
|
||||
console.error('Failed to change language:', error)
|
||||
} finally {
|
||||
isChangingLanguage.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user