'Language & url change in headless CMS

I'm using Wordrpess as headlessCMS, nextJS, graphQL.

When i get my menu from wordpress it has links in this way
For ENG:
"/about-us"
For PL:
"/o-nas"

My goal is to have one template in my files, for example "/pages/about.js"; and then when user enters "/about-us" or "/o-nas" then "/pages/about.js" file is used (inside it, by useRouter I can detect if user is /en or /pl and then make specific query for data).

How can I create this kind of idk. 'redirection'? I tried using but i wasn't able to make anything working

Can anyone help me or provide some kind of working example?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source