diff --git a/src/components/LeftMenuItem.vue b/src/components/LeftMenuItem.vue index 976136394..cf12157e1 100644 --- a/src/components/LeftMenuItem.vue +++ b/src/components/LeftMenuItem.vue @@ -2,7 +2,7 @@ import { computed } from 'vue'; import { useI18n } from 'vue-i18n'; -const { t } = useI18n(); +const { t, te } = useI18n(); const props = defineProps({ item: { @@ -11,19 +11,30 @@ const props = defineProps({ }, }); -const item = computed(() => props.item); // eslint-disable-line vue/no-dupe-keys +const itemComputed = computed(() => { + const item = JSON.parse(JSON.stringify(props.item)); + const [, , section] = item.title.split('.'); + + if (!te(item.title)) item.title = t(`globals.pageTitles.${section}`); + return item; +}); diff --git a/src/components/common/VnBreadcrumbs.vue b/src/components/common/VnBreadcrumbs.vue index 09bc198f7..337507233 100644 --- a/src/components/common/VnBreadcrumbs.vue +++ b/src/components/common/VnBreadcrumbs.vue @@ -5,16 +5,16 @@ import { useQuasar } from 'quasar'; import { useI18n } from 'vue-i18n'; import { useCamelCase } from 'src/composables/useCamelCase'; -const router = useRouter(); -const quasar = useQuasar(); -const { t } = useI18n(); +const { currentRoute } = useRouter(); +const { screen } = useQuasar(); +const { t, te } = useI18n(); let matched = ref([]); let breadcrumbs = ref([]); let root = ref(null); watchEffect(() => { - matched.value = router.currentRoute.value.matched.filter( + matched.value = currentRoute.value.matched.filter( (matched) => Object.keys(matched.meta).length ); breadcrumbs.value.length = 0; @@ -34,13 +34,17 @@ function getBreadcrumb(param) { icon: param.meta.icon, path: param.path, root: root.value, + locale: t(`globals.pageTitles.${param.meta.title}`), }; - if (quasar.screen.gt.sm) { + if (screen.gt.sm) { breadcrumb.name = param.name; breadcrumb.title = useCamelCase(param.meta.title); } + const moduleLocale = `${breadcrumb.root}.pageTitles.${breadcrumb.title}`; + if (te(moduleLocale)) breadcrumb.locale = t(moduleLocale); + return breadcrumb; } @@ -50,7 +54,7 @@ function getBreadcrumb(param) { v-for="(breadcrumb, index) of breadcrumbs" :key="index" :icon="breadcrumb.icon" - :label="t(`${breadcrumb.root}.pageTitles.${breadcrumb.title}`)" + :label="breadcrumb.locale" :to="breadcrumb.path" /> diff --git a/src/components/common/VnLog.vue b/src/components/common/VnLog.vue index 5c70b900d..794e4cc8f 100644 --- a/src/components/common/VnLog.vue +++ b/src/components/common/VnLog.vue @@ -403,7 +403,7 @@ setLogTree(); auto-load />
diff --git a/src/components/ui/CardDescriptor.vue b/src/components/ui/CardDescriptor.vue index 85e0a7857..97aa91728 100644 --- a/src/components/ui/CardDescriptor.vue +++ b/src/components/ui/CardDescriptor.vue @@ -1,5 +1,5 @@