This is a plugin to Hexchat that provides translated chat features enabling one to easily chat with people in other tongues. Translation is automatic so all participants can focus on the conversation without any thought to the translations taking place.
Your outgoing messages will be translated into the target language of your choice, and incoming messages will be translated back into your native tongue. The translated text will be on the first line, with the original message below it.
The plugin was implemented in Rust using a hexchat-api to the Hexchat Plugin Interface. The translations are provided by DeepL's API service. DeepL provides high-quality translations with a free tier that includes 500,000 characters per month.
To use this plugin, you need to obtain a free DeepL API key:
- Visit DeepL API Free and sign up for a free account
- Get your API authentication key from the account settings
- Set the environment variable
DEEPL_API_KEYto your API key before starting Hexchat
Windows:
setx DEEPL_API_KEY "your-deepl-api-key-here"Linux/macOS:
export DEEPL_API_KEY="your-deepl-api-key-here"You can also add the export line to your shell profile (.bashrc, .zshrc, etc.) to make it permanent.
/LISTLANG- Lists all the supported langauges.
/SETLANG <your-language> <other-langauge>- Sets the the languages to translate to/from in the current channel.
/LSAY <message>- Like
/SAY, sends a translated message to the IRC chat channel.
- Like
/LME <emote-message>- Like
/ME, sends a translated emote message to the channel.
- Like
/OFFLANG- Turns off translation in the current channel.
The help for these can be accessed through the Hexchat "/HELP" command.
This plugin is stable, but experimental. It interacts with DeepL's translation API service which provides high-quality translations with generous rate limits on the free tier.
To add it to Hexchat, you can put the relevant binary in the "addons" folder of your system's Hexchat config directory.
~/.config/hexchat/addonsfor Linux%APPDATA%\HexChat\addonson Windows
Or you can load it directly from the UI:
Window > Plugins and Scripts > Load- then navigate to the file and load it.
It's fairly easy to set up a Rust build environment on your system. You can find
instructions here. The process
is automated using rustup. Once that's in place, simply clone this project
and launch the build process:
git clone https://github.com/ttappr/hexchat_translator.gitcd hexchat_translatorcargo build --releasecd target/release && ls -aland there's your binary.
This project uses a Rust Hexchat API lib, which other developers may find useful for writing their own Rust Hexchat plugins. It has some nice features like
- A thread-safe API.
- Simple
user_dataobjects. - Abstractions like
Contextthat make it simple to interact with specific tabs/windows in the UI. - Panic's are caught and displayed in the active window.