Support Center

Find your answer in our knowledge base

Preselect Language For A Multilingual Chatbot

The purpose of this tutorial is to preselect website chatbot language based on language selection of user on your site.   In order to make your chatbot multi-lingual you need to contact our team at ​[email protected]​ in order to activate the multi-language for your chatbot.   Once it’s activated you can proceed with the steps below to show load our website widget in the pre-selected language of your website by the user.   For this tutorial we have assumed that you have already pasted the website chatbot code on your website. Now copy the code provided below and paste it under the website chatbot code:
function setParams() {
 var params = {
  'language': "<?php echo (isset($_GET['language'])) ? $_GET['language'] : '';  ?>"
 };
 return params;
}
  The above example is based on PHP code but you can replace PHP code with the code your website has developed.   Or you can also simply hard code the language based on the user sessions or your location based website. For example
function setParams() {
 var params = {
  'language': "es"
 };
 return params;
}
  Make sure your website doesn't have already existed function with the name of setParams in your JS code. *Note: ​The value language should be in standard shortcode, like “en” for English, “es” for Spanish.