Skip to main content

entirius-django-utils-translator

Shared translation building blocks for the modules of Entirius, the open-source modular ecommerce platform. The package holds the HTTP client for the translation endpoints of an AI toolbox service, its error classes, base request and response schemas and HTML sanitising. It has no models, no migrations and no endpoints.

PyPI Python License: MPL-2.0

What it does

  • A ToolboxClient for the translation endpoints: cost estimates, jobs, job status and results.
  • Retries with backoff on transient failures, and batches large estimate requests.
  • Typed errors and a DRF mapping (handle_toolbox_error) shared by the translator modules.
  • Base Pydantic request and response schemas for translate and bulk-translate calls.
  • HTML sanitising of translated text and a mapping from language codes to provider codes.

Installation

uv add entirius-django-utils-translator
pip install entirius-django-utils-translator
INSTALLED_APPS = [
    # ...
    "django_utils",
    "django_utils_translator",
]

The client needs a reachable AI toolbox service, configured through AI_TOOLBOX_BASE_URL, AI_TOOLBOX_API_KEY and AI_TOOLBOX_CHANNEL of entirius-django-utils. The toolbox itself is not part of this package. Settings reference: https://github.com/entirius/entirius-django-utils/blob/develop/docs/toolbox-client.md

AI_TRANSLATOR_LANGUAGE_CODE_MAP optionally replaces the built-in map from language codes to provider codes.

Quick start

from django_utils_translator.clients import ToolboxClient

items = [{"key": "product.1.name", "text": "Garden chair"}]

with ToolboxClient() as client:
    estimate = client.estimate(items, target_languages=["pl"])

The client is a subclass of django_utils.toolbox.ToolboxClient from entirius-django-utils.

Requirements

  • Python 3.11 or newer, Django 5.0 or newer.
  • A reachable AI toolbox service (AI_TOOLBOX_* settings); no database.
  • Entirius packages pulled in: entirius-django-utils.

Documentation

Part of Entirius

The translator modules of the Entirius backend service (Volkanos) build on this package.

Development

make install     # sync dependencies (uv, incl. extras)
make check       # lint + format check (ruff)
make test        # test suite (pytest; httpx mocked with respx, no database)

Development and agent instructions: https://github.com/entirius/entirius-django-utils-translator/blob/develop/AGENTS.md

License

Mozilla Public License 2.0 (MPL-2.0) — see https://github.com/entirius/entirius-django-utils-translator/blob/develop/LICENSE.

Metadata

Release files for entirius-django-utils-translator 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for entirius-django-utils-translator 2.2.0
File Size Uploaded
entirius_django_utils_translator-2.2.0.tar.gz 72.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for entirius-django-utils-translator 2.2.0
File Interpreter ABI Platform
entirius_django_utils_translator-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 90.4 kB

Release files / entirius_django_utils_translator-2.2.0.tar.gz

Download URL entirius_django_utils_translator-2.2.0.tar.gz
Size 72.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7ed4f1edc19cbb1d83695756fb545a11284044374dde1387886ce9eb3ef334f8
BLAKE2b-256 checksum
How to use checksums
1b21fcd0bde0ffdf4ac067644f3dccacf4dbfb5eb8a3a2c11353157cc069760f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / entirius_django_utils_translator-2.2.0-py3-none-any.whl

Download URL entirius_django_utils_translator-2.2.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a09b97587a7c1b6ca2c00328dca28f1d9fbbce9fbc0a4157ddc63d1f2ad212d
BLAKE2b-256 checksum
How to use checksums
5d579ad772575ec1f01d32894f587076a7746f88ed1e5237ca9c02e658f0b8c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page