Replace the page url with a menu link?

i want to make a multilangual site, where the secondary language is a copy of the site in a different folder. For example:

  • Primary language url: example.com
  • Secondary language url: example.com/en

So there are two websites with the same content, only the language and the directory are different.

I want to create a language switcher menu item that dynamically changes the page url. For example:

  • if i'm on the example.com/about page after clicking the language switcher menu item, i want to go to the example.com/en/about page.
  • so all it have to do is that this menu item dynamically changes the current page's url (it replaces the original domain from example.com/ to example.com/en), and it does not modify the rest of the url (the url structure on the two sides is of course the same)

I hope I have been able to describe it clearly.

Thanks for the help in advance!

Topic switch language multi-language menus Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.