Skip to content

Commit 29187a8

Browse files
committed
since this language change is done on client side we need to update the lang attribute ourself #2328
1 parent 8a4fd52 commit 29187a8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/ssg/components/LanguageSwitchLink.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const LanguageSwitchLink = ({ locale, ...rest }) => {
2525
<Link href={href}>
2626
<button
2727
style={{ fontSize: 'small' }}
28-
onClick={() => languageDetector.cache(locale)}
28+
onClick={() => {
29+
languageDetector.cache(locale)
30+
// eslint-disable-next-line no-undef
31+
document.documentElement.lang = locale
32+
}}
2933
>
3034
{locale}
3135
</button>

0 commit comments

Comments
 (0)