•June 22nd 2020
With Stream Chat, messages can now be translated on-demand or automatically. In turn, users speaking different languages can communicate in the same channel.
Enabling Message Translation
By default, message translation is not enabled. However, users can ask Stream’s support team to get access to this feature, and from that point forward, it will be enabled automatically. Once the feature is enabled, users will be able to automatically translate all messages or use the message translation endpoint for individual messages.
Message Translation Endpoint
This API endpoint translates an existing message to another language. By analyzing its text, the source language is inferred or detected automatically. The endpoint returns the translated message, updates it, and sends an event to all users on the channel. Click here to see all available languages.
Internationalization creates fewer barriers to entry by allowing users to speak their native language within chat. With i18n data, a conversation can be adapted to various languages on the fly with almost zero development overhead. When Stream translates a message, the i18n object is added to the returned payload. The i18n object includes the text of the original language and the message text in all other specified languages.
Automatic Translation by Stream translates all messages immediately upon being added to a channel. These messages are delivered to other users in the channel with the translated text directly included. This feature works well for one-on-one conversations between users speaking different languages or in group channels with two main languages.
Let's see how this works in practice:
- A user sends a message, and the automatic translation is enabled
- The language set for that user is utilized as the source language
- The message text is translated into the other language is used on the channel by its members
Enabling Automatic Translation
Automatic translation is not enabled by default. Users can enable it for their applications via API or CLI. They can also allow auto-translation on a per-channel basis.
Caveats and Limits
- Translation is only done for messages with up to 5,000 characters. Blowin' In The Wind from Bob Dylan contains less than 1,000 characters
- Error messages and commands are not translated (i.e.
- When a message is updated, translations are recomputed automatically
Changing translation settings or user language have no effect on messages that are already translated
Message Translation helps users seamlessly communicate with one another. If you are interested in learning more about this feature, reach out to our support team so that we can help you get set up.