A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat(PageTags): Set the language attribute for the document
haitaooe1e662735720
diff --git a/ui/src/components/PageTags/index.tsx b/ui/src/components/PageTags/index.tsxindex bd6d02a4..74d197b5 100644--- a/ui/src/components/PageTags/index.tsx+++ b/ui/src/components/PageTags/index.tsx@@ -2,6 +2,7 @@ import { FC, useEffect, useLayoutEffect } from 'react';import { Helmet } from 'react-helmet-async';import { brandingStore, pageTagStore, siteInfoStore } from '@/stores';+import { getCurrentLang } from '@/utils/localize';const doInsertCustomCSS = !document.querySelector('link[href*="custom.css"]');@@ -32,7 +33,19 @@ const Index: FC = () => {// eslint-disable-next-line no-empty} catch (ex) {}};+ const currentLang = getCurrentLang();+ const setDocLang = () => {+ if (currentLang) {+ document.documentElement.setAttribute(+ 'lang',+ currentLang.replace('_', '-'),+ );+ }+ };+ useEffect(() => {+ setDocLang();+ }, [currentLang]);useEffect(() => {setAppGenerator();}, [appVersion]);