Solved

Search results not displaying in local language

Dan_NY
Tourist
8 1 2

Hi everyone,

 

My store is translated into 4 languages. When I enter a term using the "search" function in order to find a specific product in my store, the search results will always display in English (the default language), even though the search page is set in a local language i.e. in french. 

How can I get the search results to display in the language they were searched?

Btw. I'm using the "Label" Theme.

 

I'd be immensely grateful for any help - thank you so much!

 

Accepted Solution (1)

richbrown_staff
Shopify Staff
632 91 155

This is an accepted solution.

Hi @Dan_NY , this is because in your theme in in main-search.liquid on line 46 you have action="/search" - and what that's doing is hardcoding the search URL as yourstore.com/search - so it loses the locale when you search (e.g. you want it to stay yoursearch.com/fr/search). To solve this, mention it to your theme developers as it shouldn't be this way, or you can replace it yourself with action="{{ routes.search_url }}". 

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

View solution in original post

Replies 4 (4)
Dan_NY
Tourist
8 1 2

i was actually hoping for a different answer 😄 but thank you so much for your quick reply!

richbrown_staff
Shopify Staff
632 91 155

Hi @Dan_NY @BOOST-STAR , this is not the case. You do not need to modify your theme's code to add language detection and translation abilities.

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

richbrown_staff
Shopify Staff
632 91 155

This is an accepted solution.

Hi @Dan_NY , this is because in your theme in in main-search.liquid on line 46 you have action="/search" - and what that's doing is hardcoding the search URL as yourstore.com/search - so it loses the locale when you search (e.g. you want it to stay yoursearch.com/fr/search). To solve this, mention it to your theme developers as it shouldn't be this way, or you can replace it yourself with action="{{ routes.search_url }}". 

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

Dan_NY
Tourist
8 1 2

Oh man !! @richbrown_staff  you're a genius !!! I am not familiar with liquid and/or programming at all, but I managed to find the code and changed the snippet and .... Voila!! It works.😄🎉👍🏼

Thank you from the bottom of my heart! I deeply bow to you 🙏🏽  and just gotta say it again: you're a genius !! 😄🙌🏼

Dan