Gravatar for stellalove2005@gmail.com

Question by stella, Nov 27, 2015 11:20 AM

How to Localize Facet Header in Sitecore

Hello,

We have a multi language site and we are looking for a simple way for our Content Editors to localize the Facet header title.

Thanks !

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Nov 27, 2015 2:25 PM

Hi,

You can create a custom facet component called DictionaryFacet by duplicating the existing CoveoFacet.ascx file and its associated sublayout item (in Web Forms). In that file, you can change the data-title attribute value for:

data-title='<%= Sitecore.Globalization.Translate.TextByDomain("FacetDictionary", Model.Title) %>'

Then, create a Sitecore dictionary named FacetDictionary somewhere in your content tree where content editors will be able to define new dictionary entries.

Then, change all your Coveo Facet component instances for Dictionary Facet components. If a dictionary entry exists with a key matching the facet title field value, it will use the translated version from the dictionary at rendering time.

I hope this helps,

Jeff

Gravatar for slangevin@coveo.com

Answer by Simon, Nov 27, 2015 2:55 PM

Hi Stella,

Just to make sure I understand properly, here is an example:

https://search.coveo.com/#sort=relevancy&f:languageFacet=[English]

You would like to change "Coveo Sites" for "Sites Coveo" if I was loading the interface in French, correct?

When you add the facet to the layout, simply change the title depending on the language version.

Cheers, Simon

Ask a question