Changing the widget language
Adding an existing language
The language of the ticketing widget can be changed through Enviso settings. Use the language variable for this:
<script>
enviso.settings.language = 'en';
</script>The translations for English, Dutch, French, German and Spanish are already available. If you wish to add another language you will have to implement it. Refer, Implementing a new language
Customizing an existing language
Determine the key for the translation you want to customise. Refer Translation keys
Note
In order to refer to translation keys for a specific language, edit the 2-letter language code in the Translation keys URL.
Example: For consulting French language keys, replace the language 2-letter code to fr in the Translation keys URL.
Translation key URL: https://widget.enviso.io/src/components/assets/translations/en.json
Translation key URL edited for French language keys: https://widget.enviso.io/src/components/assets/translations/fr.json
Currently, translations are available in English (en), Dutch (nl), French (fr), German (de) and Spanish (es).
Create a JSON array containing the key for the language you want to customise
<script>
enviso.settings.translations = {
'nl' : {
'My Order': 'Winkelmandje',
'Ticket' : 'Toegangsticket'
}
};
</script>Implementing a new language
For example, you want to implement Italian:
Determine the key for the translation you want to customise
To implement the language, you will need to provide a translation for every key
Note
If you require translations for languages other than the languages available in the Ticketing widget, contact our Support desk.
<script>
enviso.settings.translations = {
'it' : {
'Ticket': 'Biglietto',
'My Order' : 'Il mio ordine',
// All other keys
}
};
</script>Once the keys are added, you just set the language setting of the Ticketing widget to the new language.
<script>
enviso.settings.language = 'it';
</script>Example of code for multiple languages
Adding multiple languages can be done via code.
<select id="select-language" onchange="changeLanguage()">
<option value="nl"> NL (Dutch) </option>
<option value="fr"> FR (French) </option>
<option value="en"> EN (English) </option>
<option value="de"> DE (German) </option>
<option value="es"> ES (Spanish) </option>
</select>
<hr>
<enviso-ticket-widget> </enviso-ticket-widget>
<script>
enviso.settings.language = 'nl';
enviso.settings.translations = {'nl': {'My Order': 'Winkelmandje'}};
function changeLanguage() {
console.log(arguments);
enviso.settings.language = document.getElementById("select-language").value;
}
</script>Note
In order to translate offers, go to Enviso Sales > My Offers > Select an offer. For a detailed description on translating offers, refer Add translations for an offer