chat_translate/README.md
2026-08-23 15:21:57 +05:00

88 lines
2.7 KiB
Markdown

# Chat Translator
**English** | [Русский](README_RU.md)
A NeoForge mod for Minecraft **1.21.1** that automatically translates chat messages so every player sees them in their own language. Powered by [LibreTranslate](https://libretranslate.com).
## Features
- Per-player translation: each recipient gets the message in their configured language
- Works with vanilla clients: they simply see the original text (translation requires the mod on the client)
- Language sources: client locale reported by the mod, vanilla client settings, or automatic detection of the message text (`/detect`)
- In-game settings GUI (keybind is unbound by default)
- Translation cache with configurable TTL
- Optional "show original" line under the translation
## Requirements
| Side | Mod required | Result |
|------|--------------|--------|
| Server + Client | yes | Full translation |
| Server only | server | Players see original messages |
| Client only | client | Does nothing |
- Minecraft 1.21.1
- NeoForge 21.1.x
- A reachable LibreTranslate instance
## Installation
1. Drop `chattranslator-x.y.z.jar` into the `mods/` folder **of your server and/or client**.
2. Make sure a LibreTranslate instance is reachable (see below).
3. On the server, edit `config/chattranslator-server.toml`:
```toml
[server]
enabled = true
libretranslate_url = "http://localhost:5000"
api_key = ""
show_original = true
autodetect_language = false
cache_minutes = 30
request_timeout_ms = 5000
```
### Running LibreTranslate
Self-hosted via Docker:
```bash
docker run -p 5000:5000 libretranslate/libretranslate
```
Or use a free public instance (no API key):
```
https://translate.argosopentech.com
```
`https://libretranslate.com` also works, but requires an API key.
## Usage
Open the settings GUI with a configurable keybind (**Options → Controls → Key Binds → Chat Translator**). From there you can pick your language, test the LibreTranslate connection, and toggle "show original".
> Note: the GUI edits the *server* config, which only takes effect in singleplayer. On dedicated servers use the config file or commands below.
### Commands (operators)
| Command | Description |
|---------|-------------|
| `/chattranslate status` | Show status and current URL |
| `/chattranslate enable` / `disable` | Toggle translation globally |
| `/chattranslate seturl <url>` | Set the LibreTranslate URL |
| `/chattranslate setkey <key>` | Set the API key |
| `/chattranslate showoriginal <true\|false>` | Toggle original messages under translations |
| `/chattranslate clearcache` | Clear the translation cache |
## Building from source
```bash
gradlew build
```
The jar is written to `build/libs/chattranslator-1.0.0.jar`.
## License
[MIT](LICENSE)