Hello!
Issue description:
I load a page with the subpath "/de/*" (which is not my default language) and i would like the "HTML" language attribute to change to "de" accordingly and be sure to have this always in sync.
Background:
This issue is (for me) related to #155 (html lang tag does not change when changing language) - thanks for patching it, but for the initial value not after a navigation / changing the language.
Thank you in advance for crafting this library and please let me know if i can or should provide any additional information.
Right now is possible to workaround this using this:
If it's useful, we can provide this helper from the library.
Thanks @aralroca! It solves the Issue.
I think it would be best to include it and add it in to the docs, so nobody else will open this question again
It make sense! Thanks @dnepro
@dnepro on 0.17.0-canary.1 is available the helper:
import Document, { Html, Head, Main, NextScript } from 'next/document'
import documentLang from 'next-translate/documentLang'
export default class MyDocument extends Document {
render() {
return (
<Html lang={documentLang(this.props)}>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
)
}
}
Thank you it works like a charm!