0

In D8, with the usual translation modules enabled, I have a custom pop-up to change language on our site. Currently, it contains a link and text, like this:

<p><a href="/en-us[current-page:url:alias]">EN</a> | <a href="/es-us[current-page:url:alias]">ES</a></p>

This would work, except that the link of the translated page is different.

Example. If I'm on the English page, "website.com/contact-us" and change my language to Spanish, the page will load "website.com/es-us/contact-us" ... which does not exist. It's a 404 error

But that is incorrect. The Spanish version is correctly spelled 'contáctenos" So, I want the Spanish user to go to "website.com/es-us/contactenos.

Is there a way to do this with the tokens? Or another approach? Some way to know to send the user to the Spanish url translation of the page

Thank you!

  • The straight forward way would be using core's "Language Switcher" block. – Hudri Sep 20 '19 at 7:03
  • I can't in this case, I need a large lightbox screen that is much more involved than the language switcher dropdown field block can handle, from what I've been able to determine so far – turpentyne Sep 21 '19 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.