Unable to enforce language in Web SDK through interactiveLanguage

I have created a bot in 2 languages: English and Spanish.
They both work on bot builder, however when I try to load this in webSDK and set the interactiveLanguage parameter to “es” in LocalStorage, both through code and browser, the bot still continues to respond in English.

@atlee_fernandes I am having to edit the topic summary from ’ Multi-language not supported in Web SDK’ to ‘Unable to enforce language in Web SDK through interactiveLanguage’ because that might mislead the users.
How are you using interactiveLanguage? You have written that you are setting es in local storage. This must be used as a key in the customData object (which is a sub-object under botOptions.botInfo. Please refer to the below posts to see if you are missing some details.

1 Like

Thanks @swagata.sengupta @paul.osborn !

I am able to pass custom data and the value of the language correctly. I did see your link on using botkit and will try this way out.

But would like to know if there’s a way to set the language without using botkit.

Hello @atlee_fernandes

To enforce the language before detection through utterance, we have to use Botkit. Other alternatives are not feasible.

If custom data worked for you, it is the Web-SDK and not BotKit. I hope you are not confused about that part. Web SDK is just a client library for the Kore web channel.

BotKit is a middleware. It is an extended NodeJS program that can tap into all the bot-user communication and enable agent transfer if needed.

Setting the interactive language can be done from both WebSDK and BotKit. But for a channel that is not controlled by Kore, BotKit will be a better option to go about.

You may also consider disabling all other languages in the bot if that works for you.

@swagata.sengupta. Yes, I’m looking for something in WebSDK itself not BotKit.
I needed a way for the WebSDK to detect the browser’s preferred language and trigger the chatbot automatically in that language (assuming it’s enabled in kore).

What I meant by custom data working was: I was able to send my data to the bot thorugh custom data but was still not able to set the language, even thought I used the same interactiveLanguage tag.

While reading I was able to find the solution here using custom data itself.
Can I switch language using script node? - NLP / Language Training - Kore.ai Bot Developers Community

Now I have been able to link the browsers language and pass the browser language to the bot, without a need of scripts in the bot or the botkit middleware to read the custom data explicitly and set the bot language.

Thanks for the references to the BotKit part. I’m sure this too will come in handy.