UX Specs: Auto-translation MVP
Overview
The Auto-translation feature allows users to read channel messages in their preferred language, enhancing inclusivity and global collaboration.
Translation is executed server-side and personalized per user based on language preferences set in their user profile.
The goal is to provide the option to choose the translation service backend (e.g. LLM, Google, AWS, etc). To start we will be using LibreTranslate and LLM support for the MVP.
User Functions
Channel Admins - Enabling Translation for a Channel
Before end-users can use auto-translation for a channel, it must be enabled by the channel admin. Once enabled from the channel settings modal, it is automatically turned on for all members in the channel. Users can opt-out if they choose (see below).
Enabling translation for a DM/GM
In a DM or GM, since there is not a channel settings modal or a concept of an admin to enable auto-translation, the option is automatically available in the channel header menu for all users in the DM/GM.
Once enabled:
For the MVP:
Translation is turned on for the channel for all new messages. Past messages are not translated.
A system message will be posted in the channel stating translation has been enabled for the channel.
A label will also appear in the channel header indicating that the channel is being auto-translated. This will only appear if it’s enabled in the channel settings AND the user has left it enabled for themselves.
Hovering over the channel label will show a tooltip. Additional text is shown stating “Message data is sent to an [translation provider] for translation”
An indicator will also appear for each message that has been translated. Clicking this indicator will open the ‘Show Translationʼ modal (See View original translation)
End-users opting out of auto-translation
Once a channel admin has enabled auto-translation for a channel, it is automatically set to on for all channel members.
Users can opt-out of this by opening the channel menu and toggling it off.
Other users in the same channel can enable or disable auto-translation independently. Turning off auto-translate for yourself does not disable it for everyone.
Once a user turns off Auto-translation for themselves, an ephemeral messages is posted in the channel from the System bot.
Additionally, the Auto-translated label is removed from the channel header.
If a user’s language is not supported (not a target language)
If the user’s language is not one of the target languages set in the auto-translation configuration, then the option to enable/disable it is greyed out in the channel menu with subtext stating ‘Your language is not supported’. Additionaly, the label in the channel header should not show if the users' language is not supported.
If a user changes their language preferences
When a user updates their preferred language in Settings > Display > Language, the auto-translation system must adapt to translate accordingly.
All newly received messages will be translated into the updated preferred language (provided the preferred language is one of the targeted languages.
Existing messages:
On desktop: Loaded messages in the current channel have their langauge swapped out.
On mobile: Because of local storage, all existing translations for stored posts are replaced with translations in the new language.
What gets translated
The original language is auto-detected by the back-end first. The source language is not limited to the available languages set in the system console localization settings.
We will only translate to destination languages that are supported by the system console config “target languages”.
Translation should only display for messages that have a source language that differs from the channel members' language (set in user preferences). If the source and destination language are the same for a user, always use the source.
For the MVP, messages that come in to a channel after translation has been enabled by the channel admin will get translated. Channel history will not get translated in initial version.
Message Editing
If a user edits a message that has been translated, the message will be re-translated upon edit - any cached translations will be invalidated and updated.
View Original Translation
Users can view the original message text through the message actions menu. A new ‘Show translation’ option will be available there.
This menu option will be shown, but disabled if the original language is already in the user’s prefered language - no translation needs to be shown.
This menu option will also be disabled if the user’s language is not supported in the “target languages” auto-translation settings
When this menu option is clicked, a side-by-side comparison option is provided in a modal for better understanding (see below).
NOTE: Initial implementation will not include any feedback mechanisms or ability to regenerate.
A tooltip displays on hover,on the “translation by” label in this modal to inform users about the possibility that data may be sent out to external translation providers.
Translating state behavior
Single message translation
Ideally, messages should show in their already translated state - provided we get the translation without much latency.
When a new message comes in to the channel:
we hide the original message for up to 1s, then immediately show the translated message when it comes in.
If it’s taking >1s, we show the original post in a ‘translating’ state. Once the translation is received we swap the pot content with the translation.
If it’s taking >10s, we will consider it a failure state and we will show the original post, with a ‘translation failed’ status and a ‘retry’ button.
Video sample of translating state:
Turning off auto-translation for a channel
When a user disables auto-translation in a channel, all translated messages will revert to their original untranslated state.
A confirmation prompt or warning may be needed here to alleviate confusion.
Notifications
Because we may not have the translated text at the time of sending out a notification, we will need send the untranslated text along with a prefix or suffix (TBD) to identify as such.
Web/Desktop/Mobile notifications
These notifications should include (translation pending) right before the actual message text.
We should update the notification (if possible) with the translated text, once we have it).
Email notifications
For email notifications, ideally, wait until we get the translation and then send the translated text in the email with a ‘Auto-translated’ indicator at the bottom.
If we fail to get the translation in a reasonable time we will show the original text with a ‘See translation’ link below the message text.
Threads
Threads from channels that are auto-translated will also be translated everywhere they display (RHS, Threads view). The ‘Translated’ incidicator will also show in this context.
Permalink Previews
For permalinks preview, if the message is in a channel where auto-translation is enabled, and we have the translation for the message at the time or rendering the permalink preview, we’ll show the message in the user’s preferred language. An indicator should show in the header, hovering could open up the translation comparison modal.
Accessibility
For any message that shows as a different language from the rest of the user’s interface, we should add the lang attribute to the html element that contains text that is in a different langauge to signal screen readers and browsers that it’s in a different language.
This is really only applicable when a message doesn’t load or when viewing the side-by-side comparison in the Show modal window.
Feature Discovery
For channel admins
When a different language from the channel admin’s preference is detected and auto-translation has not yet been enabled, upon entering a channel a toast appears prompting them to enable auto-translation. This is a dismissable toast that can be hidden by clicking the x. Clicking ‘enable’ will open the channel settings on the config tag.
Logic for displaying this toast:
Trigger the toast when one visible message is in a language that is different from the user's preferred language
Show only for users who have access to enable auto-translation for the channel
Show on channel entry, not mid-scroll
Don't show again if they have dismissed this toast previously for that channel.
Burn-on-read messages (unsupported)
For the MVP, Auto-translation will not be supported for burn-on-read messages. This may be re-evaluated after the first release.
To this end, when a burn-on-read message is posted in a channel with auto-translation turned on, the note ‘Auto-translation not supported’ will display on the obscured message prior to clicking.
Mobile UX
This feature will be fully supported on mobile clients. The following outlines how the various functions and UI elements vary on mobile.
Channel admins enabling auto-translation
To prevent confusion between the admin and end-user settings, we’re going to introduce a new ‘Channel settings’ menu item in the channel info modal. This will combine the channel info (formerly edit channel), auto-translation and archive channel options. This will also better align with the channel menu on the webapp.
End-users opting out of auto-translation
The end-user auto-translation option, is not available until it’s turned on by a channel admin in the channel settings (same as webapp) as per the above.
End-users can disable auto-translation for a given channel by opening up the channel info modal. The ‘Auto-translation’ item will appear under the ‘Notifications’ menu item and can be toggled on/off with the switch.
When enabled, the subtitle in the menu item will show ‘On’ with the language that it will be translated to.
Unsupported languages
If the user’s language is not supported, this option should be disabled. If a user attempts to tap the option still, a modal opens explaining that their language is not supported.
Single message translating
The same mechanics will be in place for mobile as outlined above for the webapp.
Bulk translating
Bulk translation occurs when a user turns on translation for a channel that has auto-translation enabled with historical content. A toast shows at the bottom of the screen with a loader and animated gradient animation overlaying the entire channel while bulk translation is being done.
Turning off auto-translation
If auto translation is currently on and a user chooses to disable it, a confirmation dialog appears first.
Once confirmed, a toast is shown indicating it has been turned off.
Feature discovery
For channel admins, to help with discovery of this feature, a toast will appear at the bottom of the channel when a different language from the their preference is detected upon entering a channel (as long as their language is in the list of targeted languages for autotranslation (see system console below). This is a dismissable toast that can be hidden by clicking the x. Clicking ‘enable’ will open the channel settings view where they can enable it.
Logic for displaying this toast:
Trigger the toast when one visible message is in a language that is different from the user's preferred language
Show only for users who have access to enable auto-translation for the channel
Show on channel entry, not mid-scroll
Don't show again if they have dismissed this toast previously for that channel.
Auto-translation enabled indicators
Channel indicator
A channel that has auto-translation enabled, shows an icon in the channel top-bar next to the channel title
The thread top bar will also display the same icon.
Message indicator
Just like the webapp, an auto-translation indicator shows in the header of any message that has been auto-translated.
Viewing the original translation
To view the original translation, users can do one of two things:
Tap on the auto-translation icon message indicator (see above), which will open the ‘show translation’ modal (see below)
Long-press on a message and tap the new “Show translation” option. Tapping this will open a 'Show translation' modal which compares the original message (at the top) with the auto-translated message below.
System Console Configuration
The system console configuration for auto-translation will be located under Site Configuration > Localization.
Only available on Enterprise Advanced
If the server’s license is anything below Enterprise Advanced, a feature discovery block will display in place of the auto-translation settings.
Enabling in the system console
Once a workspace is licensed with Enterprise Advanced, the toggle for auto-translation will show—disabled by default.
Once enabled, the section expands to reveal the configuration.
Choosing translation provider
Eventually, we would like to support LLMs and other translation providers as the back-end (like Google, AWS, etc Discourse does this) so we should plan ahead to support other translation services) and make it easy to swap out.
For the MVP, we will support LibreTranslate and Mattermost Agents as the back-end.
Default state
Initially, the translation provider is not set. This is to avoid showing potentially irrelevant fields.
If LibreTranslate is selected
Once LibreTranslate is chosen, the fields below progressively display
Links to LibreTranslate docs are provided.
LibreTranslate API Endpoint: the URL to use for API calls to LibreTranslate.
LibreTranlate API Key: the API key to use for API calls.
If Mattermost Agents is selected as the provider
When Mattermost Agents is selected as the translation provider, the following fields show and the LibreTranslate fields are hidden.
AI Service: This is pulled from the list of confgured AI services in the Mattermost Agents plugin. A link to this config page is provided.
IF Mattermost Agents is not configured properly (plugin is not enabled, not installed or no AI service is set up), it will show an error state:
Target Languages
Admins will need to select the languages to be used for auto-translation. Ideally, pre-selected with the 5 most-used languages in the workspace.
See languages most used on this server: An expandable table of the percentage of languages users use in the workspace
Test translation (nice-to-have feature): a button that opens a modal to test it out with the selected translation service and languages.
See https://mattermost.atlassian.net/wiki/spaces/DES/pages/4083286018
New Permission for Managing Channel Translation
A new permission will be added to the permissions scheme: Manage Channel Translation
This will be added for both Public and Private channels.
Default System Scheme settings
All members:
Manage Public Channels > Manage Channel Translation:
OffManage Private Channels > Manage Channel Translation:
Off
Channel admins
Manage Public Channels > Manage Channel Translation:
OnManage Private Channels > Manage Channel Translation:
On
Team admins
Manage Public Channels > Manage Channel Translation:
OnManage Private Channels > Manage Channel Translation:
On
System admins
Manage Public Channels > Manage Channel Translation:
On (can't be turned off)Manage Private Channels > Manage Channel Translation:
On (can't be turned off)
Not in MVP scope
Notifications
Search
Channel History
Future Considerations
See https://mattermost.atlassian.net/wiki/spaces/DES/pages/4083286018
Resources
Mobile design spec (coming soon)
PRD (coming soon)