SEO need for crawlable links in select-locale.liquid

We have not found a way to obtain the current location (URL and query params) of the user at the moment the theme is rendered, to set the href with the URL of the current location modifying the language according to each option because if the href is modified, the behavior of the link omits the javascript and the takes you to the URL you set for it.

Is there any way to solve this?

image - 2024-04-18T114620.108.png