Gravatar for erkan.yildiz@avanade.com

Question by erkany, Mar 20, 2015 5:32 PM

Coveo search box multilingual issue

Hi ,

We have a belgium site with 2 languages: nl-BE and fr-BE

Coveo search box on header is configured with the search results page ( which is a relative path in content tree )

when I am on a /nl-BE/ page and click search button - it redirects to http://root/searchresults which ignores the current language selection. Same thing goes for /fr-BE/ pages.

Is there any way to configure coveo search box "language aware" ?

Thanks

2 Replies
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Mar 22, 2015 5:06 PM

Could you simply have the search box redirect to a different search page depending on the language? Like /nl-BE/searchresults, etc. ?

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Mar 23, 2015 10:04 AM

Out of the box, the Coveo Search Box component doesn't allow this behavior. You can workaround this by:

  1. Duplicate the Coveo Search Box component and its ascx file.

  2. In your custom ascx file, create a C# method that adds the language to an URL and wrap the Model.GetSearchPageUrl() call in your method like this:

    Coveo.$('#<%= Model.SearchBoxUniqueId %>').coveo('initSearchBox', '<%= AddLanguageToUrl(Model.GetSearchPageUrl()) %>');

Ask a question