How do I translate the widgets?

You want to translate on the fly, and in one go, all the Critizr widgets used on your web page?
You want to translate the survey received by email into the language of your clients?
You need to manage several languages on your web-site?

Here's how to do it!

Using a JavaScript object

Create an object called CritizrSDK on window with a config attribute containing the desired configuration parameters.

window.CritizrSDK = {
    config: {
        lang: "ru", // note we do not prefix with cz_ here
    }
};

๐Ÿ“˜

The parameter will be forwarded to each widget open on the web page.

Using GET parameters

Set GET parameters in the page url for each configuration parameter you want to set (they have to be prefixed with cz_ to be identified as a configuration parameter for our Critizr SDK).

http://monsite.fr?cz_open=send_feedback:<place_id>&cz_lang=en

Using HTML code

Set the lang parameter in the data_params array:

<a
    class="critizr-widget"
    href="https://critizr.com/widgets/<customer_name>/<place_id>"
    data-type="store_button:stars"
    data-params='{"lang":"en"}'
> Critizr: Send feedback </a>

๐Ÿ“˜

The three methods can be used at the same time to configure our SDK but if any parameter is set twice, configuration parameters set in the page URL will prevail upon the ones defined in the JavaScript object or the web page.

โ—๏ธ

If the language code is unknown or if the requested translation does not exist in the Critizr configuration then the default language will be used: French.