Skip to content

Commit 1e5dbe5

Browse files
authored
Merge pull request #15059 from ethereum/fixLangAttributeBug-hotfix
Correctly set HTML lang attribute (hotfix from #15058)
2 parents b726ab6 + 4e98bce commit 1e5dbe5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/pages/_document.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ import { isLangRightToLeft } from "@/lib/utils/translations"
1212

1313
class Document extends NextDocument {
1414
static async getInitialProps(ctx: DocumentContext) {
15-
return await NextDocument.getInitialProps(ctx)
15+
const initialProps = await NextDocument.getInitialProps(ctx)
16+
// TODO: Fix this! Hacky way to get locale to fix search
17+
// Get locale from query
18+
const locale = ctx.query?.locale || "en"
19+
return { ...initialProps, locale }
1620
}
1721

1822
render() {
19-
const { locale } = this.props.__NEXT_DATA__
23+
const locale = this.props.locale || "en"
2024
const dir = isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"
2125

2226
return (

0 commit comments

Comments
 (0)