63 lines
1.7 KiB
Markdown
63 lines
1.7 KiB
Markdown
|
|
# libretranslate
|
||
|
|
|
||
|
|
Self-hosted [LibreTranslate](https://libretranslate.com) deployment — a free, open-source machine translation API. Used for translating church names, addresses, and mass schedule text in the **ScraperControl** pipeline.
|
||
|
|
|
||
|
|
## Service
|
||
|
|
|
||
|
|
| Service | Port | Description |
|
||
|
|
|---------|------|-------------|
|
||
|
|
| `libretranslate` | `15000` → `5000` | LibreTranslate translation API |
|
||
|
|
|
||
|
|
## Loaded Languages
|
||
|
|
|
||
|
|
Only these languages are loaded at startup (`LT_LOAD_ONLY`):
|
||
|
|
|
||
|
|
| Code | Language |
|
||
|
|
|------|----------|
|
||
|
|
| `en` | English |
|
||
|
|
| `th` | Thai |
|
||
|
|
| `tl` | Filipino (Tagalog) |
|
||
|
|
| `id` | Indonesian |
|
||
|
|
| `ms` | Malay |
|
||
|
|
|
||
|
|
These cover the Southeast Asian language churches targeted by ScraperControl importers (`import-mass-schedules-ph.ts`, `import-philmass.ts`).
|
||
|
|
|
||
|
|
## API
|
||
|
|
|
||
|
|
**Translate text:**
|
||
|
|
```bash
|
||
|
|
curl -X POST http://192.168.0.241:15000/translate \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{"q": "Misa ng Bata", "source": "tl", "target": "en"}'
|
||
|
|
```
|
||
|
|
|
||
|
|
**List available languages:**
|
||
|
|
```bash
|
||
|
|
curl http://192.168.0.241:15000/languages
|
||
|
|
```
|
||
|
|
|
||
|
|
**Web UI:** `http://192.168.0.241:15000` (enabled)
|
||
|
|
|
||
|
|
## Running
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
Note: First startup downloads language models (~several minutes). The healthcheck has a 300 s start period to account for this.
|
||
|
|
|
||
|
|
## Data Persistence
|
||
|
|
|
||
|
|
Language models and translation data are persisted in the Docker volume `libretranslate_data` (`/home/libretranslate/.local`).
|
||
|
|
|
||
|
|
## Deployment
|
||
|
|
|
||
|
|
Runs on `192.168.0.241` (albert-MacBookPro Linux server).
|
||
|
|
|
||
|
|
**Docker Compose:** `/opt/docker/libretranslate/docker-compose.yml`
|
||
|
|
|
||
|
|
| Endpoint | URL |
|
||
|
|
|----------|-----|
|
||
|
|
| Translation API | `http://192.168.0.241:15000` |
|
||
|
|
| Web UI | `http://192.168.0.241:15000` |
|