fix: html tag should have correct lang attr (#884)

This commit is contained in:
Peng Xiao 2023-02-10 12:00:36 +08:00 committed by GitHub
parent 02aea468ca
commit 7bd69809e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,8 @@ import { useAppState } from '@/providers/app-state-provider';
import { PageLoading } from '@/components/loading';
import Head from 'next/head';
import '@affine/i18n';
import { useTranslation } from '@affine/i18n';
import React from 'react';
const ThemeProvider = dynamic(() => import('@/providers/ThemeProvider'), {
ssr: false,
@ -39,6 +41,11 @@ type AppPropsWithLayout = AppProps & {
const App = ({ Component, pageProps }: AppPropsWithLayout) => {
const getLayout = Component.getLayout || (page => page);
const { i18n } = useTranslation();
React.useEffect(() => {
document.documentElement.lang = i18n.language;
}, [i18n.language]);
return (
<>