mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-22 17:03:50 +01:00
(fix) ページの言語が正しく認識されるように
This commit is contained in:
parent
4b611c964b
commit
325a3ca5dc
6
app.vue
6
app.vue
@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
|
||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
import type { Graph, Thing } from 'schema-dts';
|
import type { Graph, Thing } from 'schema-dts';
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale, locales } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const colorMode = useColorMode();
|
const colorMode = useColorMode();
|
||||||
@ -66,6 +67,7 @@ const getLdJson = (additionalGraphes: Thing[] = []): string => {
|
|||||||
ldJson['@graph'] = ldJson['@graph'].concat(additionalGraphes);
|
ldJson['@graph'] = ldJson['@graph'].concat(additionalGraphes);
|
||||||
return JSON.stringify(ldJson);
|
return JSON.stringify(ldJson);
|
||||||
};
|
};
|
||||||
|
const currentLocaleIso = computed(() => (locales.value as LocaleObject[]).find((e) => e?.code === locale.value)?.iso);
|
||||||
|
|
||||||
const head = useLocaleHead({
|
const head = useLocaleHead({
|
||||||
addSeoAttributes: true
|
addSeoAttributes: true
|
||||||
@ -87,7 +89,7 @@ const cnHead = (locale.value === 'cn') ? [
|
|||||||
|
|
||||||
useHead((): Record<string, any> => ({
|
useHead((): Record<string, any> => ({
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
lang: locale.value,
|
lang: currentLocaleIso.value,
|
||||||
'data-bs-theme': colorMode.value,
|
'data-bs-theme': colorMode.value,
|
||||||
},
|
},
|
||||||
title: getTitle(),
|
title: getTitle(),
|
||||||
|
Loading…
Reference in New Issue
Block a user