Redirecting to multilingual subdomain

Hey everyone!

I’ve got a question regarding the redirecting of subdomains.

I have a domain (my domain.de ) and a subdomain ( en. mydomain.de ). The subdomain is an english version of my original website. I’m planning to add a flag in the header section, so that a user can easily switch between the german and the english page at any given time.

In order to achieve this, I need to add some code and that’s where things are getting complicated:
If a user is on my blog page (e.g. mydomain/single-post/xx.de) and wants to switch the language, the code needs to retrieve the URL of the current page and add the prefix " en. ". Then the user should be redirected to the newly created URL (in this example: en. mydomain/single-post/xx.de).

Any suggestions how I could do that?

In my opinion that´s the only way to get a true multilingual website on Wix. If I would use the official Wix language plugin instead, I could only translate the main pages, but not the single blog articles.

I really appreciate your help!

Best regards,
Alex