Skip to main content

Automate translation of gettext PO files using LibreTranslate, Ollama, and local models

Project description

transpolibre

transpolibre is a Python program to automate translation of gettext PO files using LibreTranslate, Ollama, or local models.

Install

PyPI Installation

To install with pip from PyPI, you can do something like this:

python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install transpolibre
# For Ollama
pip install transpolibre[ollama]
# For Local Engine
pip install transpolibre[local]
# For all engines
pip install transpolibre[all]

Source Installation

Thusly, suit to taste:

git clone https://spacecruft.org/deepcrayon/transpolibre
cd transpolibre/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .

Help

$ transpolibre --help
usage: transpolibre [-h] [-a API_KEY] [-c CUDA_DEVICE] [-d] [-D {auto,cpu,gpu}] [-e {LibreTranslate,Ollama,Local}] [-f FILE] [-l] [-m MODEL] [-o] [-s SOURCE_LANG] [-t TARGET_LANG] [-u URL] [-v] [-V]

Translate PO files

options:
  -h, --help            show this help message and exit
  -a API_KEY, --api-key API_KEY
                        LibreTranslate API key
  -c CUDA_DEVICE, --cuda-device CUDA_DEVICE
                        Local CUDA device number (Default 0)
  -d, --debug           Debugging
  -D {auto,cpu,gpu}, --device {auto,cpu,gpu}
                        Device to use for local translation: auto, cpu, gpu (Default auto)
  -e {LibreTranslate,Ollama,Local}, --engine {LibreTranslate,Ollama,Local}
                        Translation engine (Default: LibreTranslate)
  -f FILE, --file FILE  PO file to translate
  -l, --list            List available languages
  -m MODEL, --model MODEL
                        Model for Local or Ollama (Default local: ModelSpace/GemmaX2-28-9B-v0.1, default Ollama: aya-expanse:32b)
  -o, --overwrite       Overwrite existing translations
  -s SOURCE_LANG, --source-lang SOURCE_LANG
                        Source Language ISO 639 code (Default en)
  -t TARGET_LANG, --target-lang TARGET_LANG
                        Target Language ISO 639 code (Default es)
  -u URL, --url URL     Engine URL (Default LibreTranslate: http://127.0.0.1:8000, default Ollama: http://127.0.0.1:11434)
  -v, --verbose         Increase output verbosity
  -V, --version         Show version

Status

Beta.

AI

"Open Source" AI models are used to generate and edit some code.

Upstream

Projects used by transpolibre.

License

Apache 2.0 or Creative Commons CC by SA 4.0 International. You may use this code, files, and text under either license.

Unofficial project, not related to upstream projects.

Upstream sources under their respective copyrights.

Copyright © 2025 Jeff Moe.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transpolibre-0.8.13.tar.gz (680.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transpolibre-0.8.13-py3-none-any.whl (31.7 kB view details)

Uploaded Python 3

File details

Details for the file transpolibre-0.8.13.tar.gz.

File metadata

  • Download URL: transpolibre-0.8.13.tar.gz
  • Upload date:
  • Size: 680.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for transpolibre-0.8.13.tar.gz
Algorithm Hash digest
SHA256 cfaa529c6428e0c3c9eafcf1947f5347b09c1a779c3ecceb33cbd31b4a499e49
MD5 2c5eb5a112eccb3f0d9951f12f8f1bf4
BLAKE2b-256 6f13b6e918734c5a24080479eaa6a575e75374fd95cfc3a4898f2e0a5883f81e

See more details on using hashes here.

File details

Details for the file transpolibre-0.8.13-py3-none-any.whl.

File metadata

  • Download URL: transpolibre-0.8.13-py3-none-any.whl
  • Upload date:
  • Size: 31.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for transpolibre-0.8.13-py3-none-any.whl
Algorithm Hash digest
SHA256 d0f2e285a3dbf64acce74c946f91334bb3df18218a0247d8189512360c62c88e
MD5 f85be5158d78d9f458ec65d0d608e185
BLAKE2b-256 ab9e8b5e765661eaf7927d6fb51d5ba8035af803bf48b7dba650af46d6541025

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page