forked from verdnatura/salix-front
refs #6098 perf: define locale equivalences in i18n folder
This commit is contained in:
parent
899ccc097a
commit
b00b2941c7
|
@ -1,17 +1,18 @@
|
|||
<script setup>
|
||||
import { onMounted, computed } from 'vue';
|
||||
import { Dark, Quasar } from 'quasar';
|
||||
import { Dark, Quasar, useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { localeEquivalence } from "src/i18n/index";
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
|
@ -20,7 +21,7 @@ const userLocale = computed({
|
|||
set(value) {
|
||||
locale.value = value;
|
||||
|
||||
if (value === 'en') value = 'en-GB';
|
||||
value = localeEquivalence[value] ?? value
|
||||
|
||||
try {
|
||||
import(`../../node_modules/quasar/lang/${value}.mjs`).then((lang) => {
|
||||
|
@ -81,6 +82,10 @@ function logout() {
|
|||
|
||||
function copyUserToken(){
|
||||
navigator.clipboard.writeText(session.getToken());
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('components.userPanel.copyToken'),
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import en from './en';
|
||||
import es from './es';
|
||||
|
||||
export const localeEquivalence = {
|
||||
'en':'en-GB'
|
||||
}
|
||||
export default {
|
||||
en: en,
|
||||
es: es,
|
||||
|
|
Loading…
Reference in New Issue