Automated translation of gettext PO files with LibreTranslate. https://spacecruft.org/deepcrayon/transpolibre
  • Python 96.5%
  • Makefile 3.5%
Find a file
2025-08-17 13:44:11 -06:00
docs v0.8.15 2025-08-17 13:44:11 -06:00
locale Update translation strings 2025-08-15 19:55:49 -06:00
src/transpolibre Merge branch 'po-ollama-1' 2025-08-17 13:39:32 -06:00
tests rm triple dash in prompt 2025-08-16 14:38:24 -06:00
.gitignore Ignore po temp files 2025-08-15 19:54:16 -06:00
BUILD.md Update formatting note 2025-03-15 20:47:16 -06:00
CHANGELOG.txt v0.8.15 2025-08-17 13:44:11 -06:00
LICENSE-apache.txt Apache 2.0 License 2025-03-07 08:42:30 -07:00
LICENSE-CC.txt CC by SA 4.0 International 2025-03-07 15:49:25 -07:00
Makefile Add tests to make 2025-08-15 17:49:20 -06:00
mypy.ini fix tests 2025-08-15 18:27:05 -06:00
pyproject.toml Add translate toolkit dep 2025-08-16 09:47:20 -06:00
pytest.ini test formatting 2025-08-15 17:54:23 -06:00
README.md Update help notes 2025-03-15 18:47:40 -06:00

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.