From cd8e6a8d55bf30072c6e42ee1f2e8b67c9795c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=A9=D0=B0=D0=B2=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B2?= Date: Mon, 7 Oct 2024 19:14:29 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=8F=D0=B7=D1=8B=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/theme/index.ts | 14 ++++++++++++-- .vitepress/theme/plugins/i18n.ts | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts index cece231..409fe7a 100644 --- a/.vitepress/theme/index.ts +++ b/.vitepress/theme/index.ts @@ -1,5 +1,5 @@ -import { h } from 'vue' -import type { Theme } from 'vitepress' +import { h, watch } from 'vue' +import { useData, type Theme } from 'vitepress' import DefaultTheme from 'vitepress/theme' import AMWDocsAsideMeta from './components/AMWDocsAsideMeta.vue' @@ -53,5 +53,15 @@ export default { app.component('app', AMWApp) app.component('Video', AMWVideo) enhanceAppWithTabs(app) + }, + setup() { + const { lang } = useData() + watch( + lang, + (val) => { + useI18n.global.locale.value = val + }, + { immediate: true } + ) } } satisfies Theme diff --git a/.vitepress/theme/plugins/i18n.ts b/.vitepress/theme/plugins/i18n.ts index 921b9c3..63f65d3 100644 --- a/.vitepress/theme/plugins/i18n.ts +++ b/.vitepress/theme/plugins/i18n.ts @@ -1,10 +1,10 @@ import { createApp } from 'vue' import { createI18n } from 'vue-i18n' -import { useData } from 'vitepress' import { AMWThemeLocales } from '../locales/index' export const useI18n = createI18n({ + legacy: false, locale: 'ru-RU', messages: AMWThemeLocales })