translate.libre.is

Natural language translation website.

LibreTranslate

LibreTranslate web translator.

Using user “jebba”, change as appropriate.

sudo apt install python3-venv python-is-python3
mkdir -p /home/jebba/devel/LibreTranslate/server
cd /home/jebba/devel/LibreTranslate/server
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
# Numpy workaround for closed bug (but not really fixed):
# https://github.com/LibreTranslate/LibreTranslate/issues/638
pip install numpy==1.26.4
pip install libretranslate

Note, the first time it is run, it will download the translation models. The web URL won’t be available until this is complete. It will download (currently) 8.7 gigs of data.

Files downloaded to here:

~/.local/share/argos-translate/packages

systemd

meh.

Crufty startup script:

systemd service file:

/etc/systemd/system/libretranslate.service

[Unit]
Description=LibreTranslate
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/home/jebba/bin/deepcrayon-libretranslate-start
WorkingDirectory=/tmp
User=jebba
Group=jebba
Restart=no
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Startup script cruft:

/home/jebba/bin/deepcrayon-libretranslate-start

#!/bin/bash

cd /home/jebba/devel/LibreTranslate/server

source venv/bin/activate

libretranslate \
  --host 0.0.0.0 \
  --port 8000 \
  --frontend-language-source en \
  --frontend-language-target es \
  --update-models \

Then:

chmod +x /home/jebba/devel/LibreTranslate/server
sudo systemctl daemon-reload
sudo systemctl start libretranslate.service
sudo systemctl enable libretranslate.service

The first time it runs it will take awhile to start as it has to download ~9 gigs of data to ~/.local/share/argos-translate/packages

Apache

URL:

or

Set up Apache proxy.

sudo apt install python3-certbot-apache
sudo certbot -d translate.libre.is
sudo systemctl restart apache2

Set up config with proxy /etc/apache2/sites-available/translate-libre-is.conf


Then set up and restart apache.

sudo rm /etc/apache2/sites-enabled/000-default*
sudo ln -s /etc/apache2/sites-available/translate-libre-is.conf \
  /etc/apache2/sites-enabled/
sudo a2enmod proxy_http proxy
sudo systemctl restart apache2