How do I translate the widgets?

Do you want to translate on the fly, and in one go, all the Goodays widgets used on your web page?
Do you want to translate the survey received by email into the language of your clients?
Do you need to manage several languages on your website?

Here's how to do it!

Using a JavaScript object

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

window.GoodaysSDK = {
	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 Goodays 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="goodays-widget"
    href="https://app.goodays.co/widgets/<customer_name>/<place_id>"
    data-type="store_button:stars"
    data-params='{"lang":"en"}'
> Goodays: 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 Goodays configuration then the default language will be used: French.