Solved

Switch to second language on current page

MattLeBlancArt
Visitor
2 0 0

Hey there,

I'm using a simple menu to switch between English and French on my site. Right now, it's setup that in the menu, the English button goes to the home page for English and for French it's the same page but with fr in the URL. It's not ideal as when someone lands on any other pages then the home page. If the user switch to French, it brings the user back to the French home page as opposed to the page they were viewing. Is there a way that the menu would switch it to the current page?

 

So lets say the user is on this page: https://www.lesproductionsfusion.com/pages/shows  I would like it to switch to the French equivalent (which is same URL but just fr in front of it) https://www.lesproductionsfusion.com/fr/pages/shows

 

I'm sure there's an easy way to do this but I couldn't find i.


Thank you so much !

Matt

 

Accepted Solution (1)

richbrown_staff
Shopify Staff
632 91 153

This is an accepted solution.

Hi @MattLeBlancArt , the reason it goes back to the homepage is that your language selector is hard coded in your navigation to go to https://www.lesproductionsfusion.com/fr : 

richbrown_staff_0-1674472026515.png

 

richbrown_staff_1-1674473287984.png

And vice versa for English. A couple of thoughts.

1) Having the language selection here (in the menu) will make this not work easily. You need a particular type of code that makes the language selector go to the relative page (i.e. same page in a different language).

2) That particular code is in most themes, but it isn't in yours. Usually you would go to the online store editor and switch on language (and country) selectors in the footer. Yours is an older Shopify theme that doesn't have this option, or has been customised to remove it.

 

You have two solutions:

A) You have the Geolocation app. You could turn the selectors on, and it will look like this:

 
 

download (1).png

B) the fuller / better solution, though a bigger job, is to upgrade theme to a newer one that works with Online Store 2.0 sections - e.g. one of these. Then enable the built in language selector.

 

If you wanted to have this selector in the menu that would require custom coding.

 

All the best,

 

Rich

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

richbrown_staff
Shopify Staff
632 91 153

This is an accepted solution.

Hi @MattLeBlancArt , the reason it goes back to the homepage is that your language selector is hard coded in your navigation to go to https://www.lesproductionsfusion.com/fr : 

richbrown_staff_0-1674472026515.png

 

richbrown_staff_1-1674473287984.png

And vice versa for English. A couple of thoughts.

1) Having the language selection here (in the menu) will make this not work easily. You need a particular type of code that makes the language selector go to the relative page (i.e. same page in a different language).

2) That particular code is in most themes, but it isn't in yours. Usually you would go to the online store editor and switch on language (and country) selectors in the footer. Yours is an older Shopify theme that doesn't have this option, or has been customised to remove it.

 

You have two solutions:

A) You have the Geolocation app. You could turn the selectors on, and it will look like this:

 
 

download (1).png

B) the fuller / better solution, though a bigger job, is to upgrade theme to a newer one that works with Online Store 2.0 sections - e.g. one of these. Then enable the built in language selector.

 

If you wanted to have this selector in the menu that would require custom coding.

 

All the best,

 

Rich

To learn more visit the Shopify Help Center or the Community Blog.

MattLeBlancArt
Visitor
2 0 0

Amazing!! Thank you so much ! I will look into all these options.
Cheers!
Matt