0
0
Fork 0

refs #6098 perf: define locale equivalences in i18n folder

This commit is contained in:
Javier Segarra 2024-01-03 09:18:35 +01:00
parent 899ccc097a
commit b00b2941c7
2 changed files with 11 additions and 4 deletions

View File

@ -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>

View File

@ -1,6 +1,8 @@
import en from './en';
import es from './es';
export const localeEquivalence = {
'en':'en-GB'
}
export default {
en: en,
es: es,