https://discord.gg/botpress logo
How to set a default bot language?
# 🤝help
q
Hi everyone, I'm setting up my first bot and I'd like to set the default language to Italian from the start. I've looked through the Bot Settings but couldn't find a global language option. Is there a specific setting I'm missing, or do I need to handle this manually at the beginning of each conversation (for example, using the Translator Agent or an action)? Thanks in advance.
l
Turn on Translater Agent and connect Start to an Executive Code and add the language of your choice like this user.TranslatorAgent.language = 'ar' (ar is arabic)
a
Hi! I can help you make your bot start in Italian by default without needing a translator each time. You can do this by setting the default language in the initialization flow or through a pre-conversation action that defines “it” as the system locale. This ensures all messages, intents, and replies are handled in Italian from the start. Could you confirm which platform you’re using so I can share the exact setup steps? @quaint-helmet-66870
w
Ciao Sergio, The Autonomous Node has an internal translator to respond in the user's language. You can also include instructions in the prompt, but if your bot contains texts not in Autonomous Node, it's best to use the @limited-pencil-78283 solution.
If you are using Webchat, here's a way to read the language from your browser/page by using this [Botpress documentation](https://botpress.com/docs/webchat/interact/send-user-data), and I've written a function to pass that information.
Copy code
js
function getUrlData() {
  return {
    origin: window.location.href, 
    language: navigator.language, 
    referrer: document.referrer
  }
}
2 Views