LibreTranslate

<< Click to Display Table of Contents >>

Navigation:  TRANSLATION with DeepL API and LibreTranslate >

LibreTranslate

LibreTranslate is a free and open-source API.

Libre_US

 

LibreTranslate can be installed on a local or internal server. It is a free and easy-to-implement solution:

Linux server:
GitHubhttps://github.com/LibreTranslate/LibreTranslate

External server:
LibreTranslate.com also offers a paid hosting service.

 

LibreTranslate can also be installed in a Docker, Windows or Linux solution:

Linux server:

sudo apt update

sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

 

Windows:

Powershell:

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

Install-Package -Name docker -ProviderName DockerMsftProvider -Force

Restart-Computer -Force

 

Start-BitsTransfer -Source "https://github.com/docker/compose/releases/latest/download/docker-compose-windows-x86_64.exe" -Destination "$Env:ProgramFiles\Docker\docker-compose.exe"

 

Commercial : www.docker.com -> create an account, download, and install Docker Desktop

 

Create a docker-compose.yml file in a dedicated folder:

services:  

 libretranslate:

   image: libretranslate/libretranslate:latest

   container_name: libre_translate

   ports:

     - "5000:5000"

   environment:

     ### Languages

     - LT_LOAD_ONLY=fr,en,nl,pt,de,es,it

     

     ### API Key

     # - LT_API_KEYS=true  # API Key?

     

     ### LIMITATIONS :

     #- LT_REQS_LIMIT=30        # Max 30 requests / mn / user

     #- LT_CHARACTER_LIMIT=5000  # 5000 chars Max / request

     

     ### Keys DB Path

     # command: ["--api-keys", "--api-keys-db-path", "/home/libretranslate/.local/api_keys.db"]      

   

   volumes:

     - lt-local:/home/libretranslate/.local

   

   restart: always

 

volumes:

 lt-local:

 

Creating the Docker container with a command:

docker-compose up -d

 

Docker is then created and the service starts listening on port 5000 on localhost (this can be changed in docker-compose.yml).

 

Any modification to docker-compose.yml followed by a "docker-compose up -d" command updates the container.

Arrêt du service : docker-compose stop

 

 

To use LibreTranslate with  vpxPrint, simply create a configuration file named "LibreTranslate.txt" in the path:

(delete DeepL.txt)

 

url=http://localhost:5000

api=xxxx-xxx-xxx-xxx

 

... indicating the address of the LibreTranslate server and its API key; url and api are optional.

 

Default values:

url=http://localhost:5000        (local server, port 5000)

api=                                        (no API key)