Redirect to translated handle after changing language in Hydrogen

Redirect to translated handle after changing language in Hydrogen

elbacko
Visitor
3 0 0

Hello!

I set up a hydrogen app and implemented a language switcher. I have translated the handles for my collections. My problem now is that i can not figure out how to redirect to the translated handle (url) after changing language.

 

Example:

My url is http://localhost:3000/collections/elektronik-technik

I switch language to English and my url is http://localhost:3000/en/collections/elektronik-technik

What i want to achieve is this url http://localhost:3000/en/collections/electronics-technology

 

How can this be done? I can see that it is working if i use the Dawn theme so it has to be possible.

Thanks in advance!

Reply 1 (1)
elbacko
Visitor
3 0 0

Thank you for your reply and your help.

Unfortunately this still does not solve my problem. I think that i have configured my shop the right way. If i "deactivate" my custom storefront and active the dawn theme, i am successfully redirected to /electronics-technology. But if i change back to my custom storefront, the language is correct after i use the language selector, but my collection handle in the url still stays at elektronik-technik.

So i guess it has something to do with my logic.

The same applies to my products. The language is correctly changing as my content does. But the url-handle stays the same.

Maybe you have some other hints for me 🙂