I have recently added localization to my Next 14 Prismic project, based on this approach. It works, partially, for I want to show the available 'Case Study pages' on my Homepage for both EN-US and NL-NL. I have localized these 'Case Study pages' and I was able to find them when I wanted to link to them in my CaseStudies component. But, when I switch the locale from the Homepage (with the LanguageSwitcher) an error pops up saying:
Error: No documents were returned regarding the below location of the error.
So, they are available in my Documents, I was able to link to them, but my component does not find these NL-NL pages. Can someone see what I am doing wrong? Might be something small. (I hope!)
Here is a link to the branch of the localization in my repo:
Hi @Phil , thanks for replying.
I am not sure what you are looking for? Where would I find this query?
My literal url is http://localhost:3000/nl-nl, but I do not think that is what you are requesting
This is logged 'before' I link to the Dutch cases:
Fetching case study with ID: ZyNd3REAACwAIBjA
[next] Fetching case study with ID: ZyNeNREAACwAIBlG
[next] Request URL: https://jorik-and-prismic.cdn.prismic.io/api/v2
[next] Request URL: https://jorik-and-prismic.cdn.prismic.io/api/v2
This is logged 'after' I link the Dutch cases again:
Fetching case study with ID: Zyt97REAADMALFnz
[next] Fetching case study with ID: Zyt7lREAAC4ALFZc
[next] ⨯ Error: No documents were returned
[next] at async eval (./src/slices/CaseStudies/index.tsx:25:30)
[next] at async Promise.all (index 0)
[next] at async CaseStudies (./src/slices/CaseStudies/index.tsx:22:25)
[next] digest: "13332751"
[next] ⨯ Error: No documents were returned
[next] at async eval (./src/slices/CaseStudies/index.tsx:25:30)
[next] at async Promise.all (index 0)
[next] at async CaseStudies (./src/slices/CaseStudies/index.tsx:22:25)
[next] digest: "13332751"
As you can see on the screenshots, the cases are there.
You can't access the params inside a server component that's why the Slice is breaking, it's querying your dutch docs by their IDs in the English locale.
What can you do?
Send your params as a prop on the SliceZone component on your homepage file: