QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.19k stars 52 forks source link

Error: Could not find locale while pre-rendering page, make sure you called `setStaticParamsLocale` at the top of your pages #414

Open hmssameer55 opened 3 weeks ago

hmssameer55 commented 3 weeks ago

Error: Could not find locale while pre-rendering page, make sure you called setStaticParamsLocale at the top of your pages.

To Reproduce (root layout file) import { getStaticParams } from '../../locales/server'

export function generateStaticParams() { return getStaticParams() }

// I have added the above function in my root layout file though build is generated successfully. once i run the build with npm run start I can see Tonnes of error logs (Error: Could not find locale while pre-rendering page, make sure you called setStaticParamsLocale at the top of your pages) in all the pages.

About

akaokaz commented 1 week ago

@hmssameer55 I had the same issue recently. I just found this, and it solved my problem too, so I thought I'd share. https://github.com/vercel/next.js/discussions/65060#discussioncomment-9885371