There are multiple solutions for this. Notably:
- Let the bot understand multiple languages at any time, but only change the response language when the user tells it to. For example:
User: "Hello"
Bot: "Hey, how are you?"
User: "Je vais bien et toi?"
Bot: "I am great! How can I help?"
User: "Parle en Francais" or "Can you speak French?"
Bot: "Ok, je vais vous répondre en Francais!"
- Let the bot understand multiple languages at any time, and change the language every time the user changes it. For example:
User: "Hello"
Bot: "Hey, how are you?"
User: "Je vais bien et toi?"
Bot: "Je vais bien! Comment puis-je vous aider?"
- Build a bot per language on different servers, and in your frontend, let the user change the language, which will connect them to the other server.
Which one are you interested in?
Solution 2 is better, but harder to implement.