Automatic translation¶
The platform has the ability to automatically translate conversations between an operator (or bot) and the end user, in real time.
Inbox user interface¶
The auto translation feature is a setting on a conversation, that can be enabled by clicking the translation button in the input bar, which then shows the following dialog in which automatic translation can be configured or disabled:
When it is enabled, the input bar button changes to show the language pair between which automatic translation is taking place.
When messages are being translated, the conversation history messages in the inbox show the original text that was typed underneath.
REST API¶
To enable automatic translation for a conversation through the REST API, submit
a PUT
request to update the existing conversation
PUT /api/bot/{bot_id}/user/{user_id}/conversation/{id}
With JSON payload:
{"auto_translation": ["nl", "en"]}
Or to disable it again,
{"auto_translation": null}
See the Update conversation API for more information.
Backend platform implementation¶
Conversations have an auto_translation
(string[]
) column, which is either
null
(when automatic translation is disabled), or a list with 2 elements:
[operator_locale, user_locale]
.
When auto translation is enabled, the following happens:
For operator actions (operator → user), the text
action gets automatically
translated. The %Bubble.Action{}%
metadata
payload will get an extra
property called auto_translated
, containing from
, to
as the locales, and
text
as the original, untranslated text.
For user actions (incoming text messages), we translate the incoming message
when auto_translation
is enabled. The same auto_translated
structure is also
stored there, in the .stats
properti of %Bubble.Message{}
.
Auto-translation is run as the first step, so before the rest of the NLP pipeline, so that intent classification etc runs on the translated text. This way we can (theoretically at least) create bots written in any language.
For each conversation where automatic translation has been used, we create a single chargeable event called "auto_translated".