cancel
Showing results for 
Search instead for 
Did you mean: 

Changing routes depending on Store View (Language)

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Changing routes depending on Store View (Language)

Hi together, 

I would like to change the Magento urls like /customer/account or /wishlist depending on the Store View (better said language) the user is currently on. 

I made a custom module and created the routes.xml which works like a charm but of course changes the urls for all store views. Is there a possibility to change the urls depending on the current store view? 

I would like to have it like this:
Store View EN: customer/account
Store View DE: kundenkonto

Thanks for any suggestions!
Rudi


 

4 REPLIES 4

Re: Changing routes depending on Store View (Language)

Hi @rudolf_uivari,

 

Maybe you can start checking here: https://docs.magento.com/m2/ce/user_guide/stores/store-urls.html

 

If your domains are pointing to the Magento instance you can set each website or store view to use a specific domain or subdomain.

You can change the value of the URL changing the scope of the configuration: https://docs.magento.com/m2/ce/user_guide/configuration/general/web.html

 

 

Re: Changing routes depending on Store View (Language)

Hi Damian, 
thanks for your reply but that is not what I was asking for. I don't want to have two different domains for each language and as well not having the language code inside the domain. 

What I would like to have as result when a user is visiting for example the whishlist:

www.example.com/wishlist -> Store View EN
www.example.com/wunschliste -> Store View DE

Independent from that, even if I would have two domains for two Store Views, I would still have only one Magento Instance and would rewrite all urls when setting the routes.xml like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="standard">
        <route id="wishlist" frontName="wunschliste">
            <module name="Magento_Checkout" />
        </route>
    </router>
</config>


So what I need is any kind of switch that allows me to set the routes in dependence of the current active Store View.

Re: Changing routes depending on Store View (Language)

Hi @rudolf_uivari,

 

Sorry, I missunderstood part of the question.

You won't be able to do it out-of-the-box.

Sections like Account, Cart, Checkout, Contact or Search result won't get translated URLs.

 

With M1 there was/is a module that allows you to do that (I didn't tried) https://github.com/klein0r/magento-language-routes but I don't remember anything for M2.

 

Maybe that module can help you to think about how to create your own solution?

 

(my 2 cents)

Re: Changing routes depending on Store View (Language)

Hi Damian, 
thank you a lot, thats a good point to start! 

Greetings