Gravatar for erkan.yildiz@avanade.com

Question by erkany, Sep 10, 2015 11:51 AM

Coveo Spanish Localization

Hi,

We are trying to localize the Coveo "ShowingResultOf" text on the search view component for a Spanish site

Problem #1:

Even though the site is in Spanish looks like Coveo picks up the "en" locale values from the below toLocaleString array element

Problem #2:

As a result of the above problem - adding a new "es" element to below array does not do anything. We still see the default English text

What is the best way to localize? We do not want to modify the /cultures/es.js file as it may be overwritten as part of each Coveo upgrade

String ["toLocaleString"] ( { "en": { "QueryDidntMatchAnyDocuments": "@Model.NoResultsText" }, "es": { "ShowingResultsOf": "Resultados {0}-{1} de {2}" } } );

2 Replies
Gravatar for erkan.yildiz@avanade.com

Answer by erkany, Sep 11, 2015 4:03 PM

The trick was to use "es-ES" for the culture info, Below code was placed on cultures/es.js and worked properly:

String["toLocaleString"](
    {
        "es-ES": 
            {
                "ShowingResultsOf": "Resultado<pl>s</pl> {0}<pl>-{1} </pl>de {2}"
            }
    }
);

String["locale"] = "es-ES";

String["defaultLocale"] = "en";
Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Sep 10, 2015 12:12 PM

Are you including the es.js file in your Spanish page?

Gravatar for erkan.yildiz@avanade.com

Comment by erkany, Sep 10, 2015 12:13 PM

yes - of course. We are using December 2014 version by the way. I see fr.JS by default has all the text translated - all other languages do not have any translation

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 10, 2015 12:21 PM

Hmm how can you include es.js if you're using a version that doesn't has it? If I remember well we added a gazillion languages in March 2015, before that it was only English and French.

Anyway - you need to both register the localized string AND change the active language. Including one of the XX.js file does that automatically (the latest one "wins"). Check in the files to see exactly how to set the language.

Gravatar for erkan.yildiz@avanade.com

Comment by erkany, Sep 10, 2015 12:29 PM

Thank you - in the search component we have the reference to ES.JS file:

script type="text/javascript" src="/Coveo/js/cultures/es.js"

I added: String["locale"] = "es"; String["defaultLocale"] = "en"; like how you guys did on FR.JS to set the language but it did not help

Gravatar for erkan.yildiz@avanade.com

Comment by erkany, Sep 11, 2015 9:53 AM

Hi - can you please let me know what else to try?

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Sep 11, 2015 9:57 AM

The proper code is String["locale"] = "es";

Gravatar for erkan.yildiz@avanade.com

Comment by erkany, Sep 11, 2015 12:00 PM

That code did not help - Where should I place it ? Before array or after ?

Ask a question