Replies: 2 comments
-
This might be related: #929 |
Beta Was this translation helpful? Give feedback.
0 replies
-
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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
How would you switch between dynamic paths in a language switcher component?
The language switcher is in the header of the app, and I would like to switch between blog pages like so:
mypage.com/nl/bloggen/blog-title-in-NL/
mypage.com/pl/blogu/blog-title-in-PL/
Paths for blog posts are only fetched in the blog posts page.
(also thinking about fetching posts and mapping them to just the pathnames in
getStaticPaths
, but I guess thats completely unrelated)I can switch between
bloggen
andblogu
because those are the hardoceded values I am storing in my pages setup in global file.One option would of course be to place the dynamic paths in a global state so they're accessible from the language switcher, but I would like to avoid adding React context or smthn like Redux to the app just for this.
Does next-intl have something like addResources in i18nexxt?
I imagine it would allow me to add all the translated blog post paths to the hardcoded pathnames that are passed to
createIntlMiddleware
?Currently my middleware pathnames has these blog-related values:
Though, I'm not sure how exactly would that allow me to get the right blog post slug in a component like language switcher anyway.
Beta Was this translation helpful? Give feedback.
All reactions