I recently had the opportunity to build a Knowledgebase search site that would support multiple languages, English and French. The technologies for the site included .NET, ServiceCloud and the Coveo JavaScript Search Framework.  In many ways, it turned out to be easier than expected due to the built-in support for languages by .NET, ServiceCloud and the Coveo JavaScript Search Framework.

This search site was being built specifically for Canadian customers who would have the option to view the site in either English or French. The Knowledgebase articles that were stored in ServiceCloud were being indexed and displayed by the Coveo JavaScript Search Framework integrated within a .NET MVC application. Clicking on a search result link initiated a call to Service Cloud to retrieve the actual content of the KB article and display it in an MVC view. To “remember” the language selection made by the user, a cookie was used to store the selection so that subsequent visits to the site would leverage the last language selection made by the user.

Resource Files

The key to providing the appropriate language in the user interface was the use of Resource files. The US resource file was named HomeTexts.resx and the French file was named Within each resource file, you specify name/value pairs.

English Resource file

French Resource file

Within my code, I can now reference the name of the resource file entry to be used as shown below.

What controls which resource file that .NET uses to return the value is based upon the following code:

So, if my user selects French as the language choice, I set the “CanadaLanguage” cookie to “fr” and set the CurrentCulture and CurrentUICulture to “fr” as shown above. This is the magic that allows .NET to pick the value from the correct resource file. So, a key in designing a site to support multiple languages is to NOT hard-code any label values but put them all in resource files.

From a Coveo configuration perspective, Coveo allows various query pipelines to be defined which provides multiple applications to leverage a single index but with different filters or views of the index. Also, each query pipeline can be configured with different Thesaurus entries and ranking expressions. So, a new pipeline was created in Coveo that included a filter to only display articles that match the language that was passed in. So, if the user selected English, the query pipeline would only pass back article links that were in English. If the user selected French, the query pipeline would only pass back article links that were in French.

To view a specific article, the user clicks on one of the links, as usual. Because our articles are stored in Service Cloud, the click of the link initiates a SOQL call to ServiceCloud to retrieve a specific KB article. The selected language, “fr” or “en” is included in the SOQL syntax (&language=fr). This ensures that ServiceCloud will return the French article versus the English article. For those not familiar with SOQL, it is “SQL for ServiceCloud” and has a very similar syntax to SQL for SQL Server or Oracle. So, “where language=’fr’” would accomplish retrieving the French version of the article versus “language = ‘en_US’” to retrieve the English version of the article.


All in all, the effort to support a second language, French, turned out to be simpler than expected. I look forward to working on other projects in the future that will support multiple languages.

Share and Enjoy !

Related Content: