-
I'm building a side project, when I try to build it I get the following error:
I'm using NextJS 15, and this is my routing.ts config: export type Locale = (typeof locales)[number]
export const locales = ['en', 'ar'] as const
export const defaultLocale: Locale = 'en'
export const routing = defineRouting({
locales,
defaultLocale: locales[0],
localePrefix: 'never'
}) I'm pretty sure I'm following as best as I can using the Docs, I need to get the user locale from a database value 'en' or 'ar'. I've even used setRequestLocale in layout.tsx: export default async function RootLayout({ children }: { children: React.ReactNode }) {
const locale = (await getUserLanguage()) ?? (await getLocale())
const messages = await getMessages({ locale })
setRequestLocale(locale) How do I solve the errors. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Your |
Beta Was this translation helpful? Give feedback.
Your
getUserLanguage
function relies on reading headers, therefore a page can naturally not be static at the same time—I guess that makes sense. For apps behind a login dynamic rendering is quite common.