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