Next.js Discord

Discord Forum

Headless Wordpress - GraphQL - Polylang

Unanswered
Nergal posted this in #help-forum
Open in Discord
I'm coding a headless wordpress with next.js for the front. Using the native fetch API and GraphQL for API requests, I want the front to be multilingual. For the data part, I installed Polylang in the BO and started translating content (including ACF fields). On the fron-end, I want the website to be multilingual with a language switcher somewhere.

The only problem is I have no idea what's the best way to do this with the app directory. Like i could wrap everything in a [lang] folder and then just update my queries based on the lang param, but if the user is looking at a post and switches to another language, how to get him to the translated one ? Or how do I save his prefered language for future visits ?

0 Replies