#Chat Translation
#Overview
The Chat Translation Extension enables real-time translation of chat messages between different languages using various translation providers. It supports both manual and automatic translation modes.
#Usage
All the ways to translate chat messages:
Translate Chat button in the Extensions menu
- Translates the entire chat history at once
Translate Input button in the Extensions menu
- Translates just the current input text
- Useful before sending a message
Translate Message icon in the Message Actions toolbar of any message
- Click to translate just that message
- Click again to revert to original text
Auto-mode configuration in the Chat Translation drawer of the Extensions panel
- Automatically translates user inputs, AI responses, or both
/translate slash command
- Use
/translate [target=language_code] text
to translate text
#Configuration
Configuration options are available in the Chat Translation drawer of the Extensions panel.
#Provider
- Choose your preferred translation service
- Click the API Key icon, if it appears, to enter an API key
- Click the Custom URL icon, if it appears, to enter a custom API URL
#Target Language
Select the language you want to write your messages in, or read AI responses in.
#Auto-mode
Configure automatic translation behavior.
- None: No automatic translation
- Translate responses: Automatically translates AI responses into the target language
- Translate inputs: Automatically translates user inputs into English
- Translate both: Translates both user inputs and AI responses
#Clear Translations
The Clear Translations button removes all translations from messages in the current chat. The original messages are preserved.
#Configuration Example: Chinese to English Chatting
To set up a workflow where a Chinese-speaking user can chat in Chinese with an AI that operates in English:
- Set Auto-mode to "Translate both"
- Set Target Language to "Chinese (Simplified)" or "Chinese (Traditional)"
- Choose a translation provider with good language auto-detection (e.g., Google or DeepL)
This setup will:
- Translate user's Chinese input to English for the AI
- Translate AI's English responses back to Chinese for the user
This setup relies on automatic language detection for input. For more precise control, future updates may include explicit source language selection.
#Translation providers
Cloud-based Local, custom URL Requires API key
#DeepL-specific configuration
- Formality levels available for German, French, Italian, Spanish, Dutch, Japanese, and Russian
- Configure via
deepl.formality
in config.yaml
#Slash Commands
Use /translate
command for quick translations. Syntax: /translate [target=language_code] text
. If target language is not provided, the value from the extension settings will be used.
#Basic usage
Translate text to the current target language and show it in a popup:
Translate text to Spanish and add it to the chat:
#Testing, pipeline translation, localization
Prompt the user for a message and a language, translate the message into that language, then re-translate it into the configured target language and show both translations in a popup. This example uses the /input
and /buttons
commands to gather user input:
This is useful for checking the quality of a translation into a language that you don't speak, before writing it somewhere important.
The UI controls are shown in the current locale, independent of the configured target language.
Input language detection is relatively effective in the following examples:
#Technical Notes
- UTF-8 encoding, special characters, and emojis are supported
- Handles large messages by splitting into chunks when needed
- Preserves formatting and embedded images in messages
- Caches translations to avoid redundant API calls
#AI input language
internal_language
controls the language into which user messages are auto-translated before being sent to the AI. It is hardcoded to 'en' in the default settings and cannot be changed through the UI. Thus, the translation target language for messages to the AI is always English. Previous testing showed that AI performance was better when receiving English messages, but this may change as more LLMs are being trained on more varied language data. I suppose one could change internal_language
in settings.json
and find out.
#Chinese variant handling
The extension supports both Simplified and Traditional Chinese, but not all translation providers do. The UI presents these as 'Chinese (Simplified)' and 'Chinese (Traditional)' respectively, with language codes 'zh-CN' and 'zh-TW'. They are mapped to the following language codes for translation providers:
- Libre Translate: 'zh-CN' to 'zh' and 'zh-TW' to 'zt'.
- DeepL and DeepLX: both variants to 'ZH'.
- Bing: 'zh-CN' to 'zh-Hans', 'zh-TW' as-is.
- Other providers use 'zh-CN' and 'zh-TW' as provided.
#Text length limits
Some providers have character limits per request:
- Yandex: 5000 characters
- DeepLX: 1500 characters
- Bing: 1000 characters
- Google: 5000 characters
Longer texts are automatically split into chunks for translation.