Tim is a Senior Consultant at ThreeWill. He has 15 years of consulting experience designing and developing browser-based solutions using Microsoft technologies. Experience over the last 8 years has focused on the design and implementation of SharePoint Intranets, Extranets and Public Sites.
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 HomeTexts.fr.resx. 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.