Files
InvoiceShelf/resources/scripts/admin/views/installation/Step0SetLanguage.vue
agencetwogether 3b61440e1f Complete dashboard translations & small UI improvements (#69)
* fix dropdown action Estimate Dashboard and fix translating full Dasboard page

* Update app.php

* fix locale in app.php config

* Wizard install with translation, customer portal with translation, and fixing hardcoding strings to get translation

* fixes asked to review

* fixes pint

---------

Co-authored-by: Max <contact@agencetwogether.fr>
Co-authored-by: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com>
2024-06-05 12:07:46 +02:00

86 lines
1.9 KiB
Vue

<template>
<BaseWizardStep
:title="$t('wizard.install_language.title')"
:description="$t('wizard.install_language.description')"
>
<div class="w-full md:w-2/3">
<div class="mb-6">
<BaseInputGroup
:label="$t('wizard.language')"
:content-loading="isFetchingInitialData"
required
>
<BaseMultiselect
v-model="currentLanguage"
:content-loading="isFetchingInitialData"
:options="languages"
label="name"
value-prop="code"
:placeholder="$t('settings.preferences.select_language')"
class="w-full"
track-by="name"
:searchable="true"
@change="changeLanguage"
/>
</BaseInputGroup>
</div>
<BaseButton
v-show="!isFetchingInitialData"
@click="next"
>
{{ $t('wizard.continue') }}
<template #left="slotProps">
<BaseIcon name="ArrowRightIcon" :class="slotProps.class" />
</template>
</BaseButton>
</div>
</BaseWizardStep>
</template>
<script setup>
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 languages = ref([])
let currentLanguage = 'en'
const installationStore = useInstallationStore()
onMounted(() => {
getLanguages()
})
async function getLanguages() {
isFetchingInitialData.value = true
const res = await installationStore.fetchInstallationLanguages()
languages.value = res.data.languages
isFetchingInitialData.value = false
}
function next() {
isSaving.value = true
emit('next')
isSaving.value = false
}
function changeLanguage(event){
if(typeof global.locale !== 'string') {
global.locale.value = event
}
}
</script>