How to Pass Internationalization Dictionary to a Next.js Error.js route?

194 Views Asked by At

I'm currently working on implementing internationalization (i18n) in my Next.js application, utilizing the App Router configuration. My challenge is to integrate i18n into an Error.js page, but I'm encountering difficulties as this page requires "use client" and the dictionary should be set on the server-side. Unfortunately, I haven't been able to find any online examples addressing this specific issue. One potential solution I've considered is passing the dictionary from the layout.js, but I'm unsure of the proper approach to achieve this.

What I tried: Looking a the Next.js documentation, but couldn't find anything I've considered is passing the dictionary from the layout.js

What I expected: I expected to find a solution or example of how to pass the i18n dictionary to the Error.js page, which needs to be rendered on the client-side, ensuring that error messages are displayed in the user's preferred language.

0

There are 0 best solutions below