Internationalization
The I18n library is already integrated in Kogno, so the development of a multi-language chatbot is relatively easy.
Last updated
Was this helpful?
The I18n library is already integrated in Kogno, so the development of a multi-language chatbot is relatively easy.
Last updated
Was this helpful?
The default locale can be set editing the configuration config.default_locale
in file.
Kogno will load automatically all .yml
files located in the folder config/locales/
.
All necessary locales files can be created. Being one for each language supported by the chatbot.
config/locales/en.yml
config/locales/es.yml
If in value there is more than one option, like in the example above, hello
with options "Hello" and "Hi", Kogno will randomly return a single one.
This would help create a less monotonous conversation.
The global method t()
(short for I18n.t()
) can be called anywhere in a project's code.
t(key=String|Symbol, **interpolation)
But this can be changed by calling the set_locale()
from User
model.
Read more examples of I18n
usage in the .
By default, the locale of a user starting a conversation for first time will be the one defined in the , if the platform has not included it in the webhook.