Metadata-Version: 2.4
Name: transpolibre
Version: 0.8.14
Summary: Automate translation of gettext PO files using LibreTranslate, Ollama, and local models
Author-email: Jeff Moe <moe@spacecruft.org>
License: Apache-2.0
Project-URL: Homepage, https://transpolibre.org
Project-URL: Documentation, https://transpolibre.org
Project-URL: Repository, https://spacecruft.org/deepcrayon/transpolibre
Project-URL: Issues, https://spacecruft.org/deepcrayon/transpolibre
Project-URL: Changelog, https://spacecruft.org/deepcrayon/transpolibre/raw/branch/main/CHANGELOG.txt
Keywords: gettext,i18n,l10n,internationalization,libretranslate,localization,ollama,machine-translation,pofiles,po-files,python,pytorch,sphinx,text-processing,torch,translation
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Natural Language :: Arabic
Classifier: Natural Language :: Bengali
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: English
Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hindi
Classifier: Natural Language :: Indonesian
Classifier: Natural Language :: Italian
Classifier: Natural Language :: Japanese
Classifier: Natural Language :: Korean
Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Spanish
Classifier: Natural Language :: Turkish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Documentation :: Sphinx
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Software Development :: Localization
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE-CC.txt
License-File: LICENSE-apache.txt
Requires-Dist: libretranslatepy
Requires-Dist: polib
Requires-Dist: pycountry
Requires-Dist: python-dotenv
Requires-Dist: requests
Requires-Dist: translate-toolkit>=3.10.0
Provides-Extra: all
Requires-Dist: libretranslatepy; extra == "all"
Requires-Dist: torch; extra == "all"
Requires-Dist: transformers; extra == "all"
Requires-Dist: accelerate; extra == "all"
Requires-Dist: bitsandbytes; extra == "all"
Requires-Dist: ollama; extra == "all"
Requires-Dist: protobuf; extra == "all"
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: dead; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: setuptools-scm; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: sphinx-autobuild; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints; extra == "dev"
Requires-Dist: sphinx-intl; extra == "dev"
Requires-Dist: sphinx-notfound-page; extra == "dev"
Requires-Dist: sphinx-rtd-theme; extra == "dev"
Requires-Dist: sphinxcontrib-markdown; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: types-polib; extra == "dev"
Requires-Dist: vulture; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-timeout>=2.1.0; extra == "test"
Requires-Dist: pytest-xdist>=3.0.0; extra == "test"
Requires-Dist: hypothesis>=6.0.0; extra == "test"
Requires-Dist: faker>=18.0.0; extra == "test"
Requires-Dist: responses>=0.23.0; extra == "test"
Requires-Dist: freezegun>=1.2.0; extra == "test"
Provides-Extra: local
Requires-Dist: torch; extra == "local"
Requires-Dist: transformers; extra == "local"
Requires-Dist: accelerate; extra == "local"
Requires-Dist: bitsandbytes; extra == "local"
Provides-Extra: ollama
Requires-Dist: ollama; extra == "ollama"
Requires-Dist: protobuf; extra == "ollama"
Dynamic: license-file

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

* https://transpolibre.org

# Install
# PyPI Installation

* https://pypi.org/project/transpolibre/

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`.

* https://libretranslate.com/
* https://www.gnu.org/software/gettext/manual/gettext.html
* https://polib.readthedocs.io
* https://github.com/argosopentech/LibreTranslate-py
* https://ollama.com/

# 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 &copy; 2025 Jeff Moe.*
