feat(i18n): 添加语言变更时更新html lang属性的功能
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 3m30s
CI/CD Pipeline / build-and-deploy (push) Successful in 4m2s
测试最新依赖 / build-and-test (push) Successful in 2m5s
测试最新依赖 / playwright (push) Successful in 2m27s

This commit is contained in:
严浩
2025-10-30 22:43:38 +08:00
parent da80cad976
commit b3fbfe2d9d

View File

@@ -7,6 +7,9 @@ import messages from '@intlify/unplugin-vue-i18n/messages';
import { createI18n } from 'vue-i18n';
const locale = useLocalStorage<string>('app-locale', navigator.language);
watchEffect(() => {
window.document.documentElement.setAttribute('lang', locale.value);
});
// https://vue-i18n.intlify.dev/guide/essentials/started.html#registering-the-i18n-plugin
export const i18nInstance = createI18n({