How to translate <title> with i18next? #3666
Closed
edwin-speer
started this conversation in
General
Replies: 1 comment
-
For anyone with the same problem: I fixed it with a hook:
And then include it in your topmost component.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using i18next to translate texts. But I'm unable to translate the page title (title meta tag/document.title).
When I do this (when following the documentation):
The text is not translated, probably because the translation file is not yet loaded when
head()
is called.The
<RouterProvider/>
is wrapped inside<I18nextProvider/>
.It seems the problem is that
head()
is only called once and not again when the translation file is loaded.I now "solved" it in a very hacky (and possibly brittle) way, like this
Later I read out the
translationKey
and setdocument.title
, but it's very non standard and not a desired solution.I couldn't find any documentation on how to solve this, although this problem seems to be not uncommon.
Is this a bug, feature request or am I missing something?
I'm using
@tanstack/router-plugin 1.111.3
Beta Was this translation helpful? Give feedback.
All reactions