Reputation: 99
I have created a bot which is in English and in indonesian language it is multilanguage but the user has to select in start in which language does he want to chat, but what i need is a way so that user can chat in any language instead of me giving an option to select the language instead a user can start the chat either in English or in Indonesian language as per his choice.I am using Dialogflow for making the bot and python as a backend for the webhook calls.
Upvotes: 0
Views: 399
Reputation: 2355
When the user send you the first message, use a library such as langdetect to detect the language.
Then you have your language : use your chatbot to answer in that specific language.
Maybe later you can improve this by detecting language on every message of the user to handle edge case (what if your user change language in the middle of the conversation ?).
Upvotes: 2