Skip to content

Navbar component translates only in root/index, not in subpages #2269

Closed Answered by zes00
zes00 asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah, so, apparantly there's a difference between reading the docs and reading (and understanding) the docs.
Issue was me not understanding how namespaces worked. (and probably not understanding how next.js renders content)

I was first setting 'common' namespace for my app-wide Navbar component on first render of index, then overriding it by setting 'pagecontent' namespace from getStaticProps on page/subroute level..

Fix:

export async function getStaticProps({ locale }) {
return {
  props: {
+    ...(await serverSideTranslations(locale, ['common','pagecontent',])), //either pass both namespaces on page level
+    ...(await serverSideTranslations(locale)), //or remove namespace array compl…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zes00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant