Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

collective.translators

This package extends plone.app.multilingual by providing pluggable external translation utilities for automatic content translation in Plone. It enables seamless integration with multiple translation providers, allowing site administrators to configure and use services such as DeepL, AWS Translate, LibreTranslate, DeepSeek, and Ollama for translating site content.

PR #468 (https://github.com/plone/plone.app.multilingual/pull/468) is a strict requirement for this addon.

Translator Utilities

This package provides pluggable translation utilities for multiple providers. Each utility exposes a similar interface for translating content and checking available languages.

Each utility is registered as a factory and can be enabled/configured via the Plone control panel. They provide a consistent API for translation tasks, making it easy to switch between providers.

1. DeepL Translator (DeeplTranslatorFactory)

Integrates with the DeepL API (Free and Pro endpoints supported). Reads the API key from the Plone registry. Supports autodetection of source language and translation of text or HTML.

2. AWS Translate (AWSTranslatorFactory)

Uses Amazon AWS Translate. Reads credentials and region from the Plone registry. Handles translation and language autodetection fallback.

3. LibreTranslate (LibreTranslateTranslatorFactory)

Integrates with the open-source LibreTranslate server. The server URL and API key can be configured. Supports autodetection and both text and HTML formats.

4. DeepSeek Translator (DeepSeekFactory)

Integrates with DeepSeek, an LLM-based translation API. Reads the API key from the registry. Uses chat completions for translation.

5. Ollama Translator (OllamaTranslatorFactory)

Integrates with the Ollama local LLM server. Allows translation using models running on your own hardware. The Ollama server URL and model can be configured. Useful for private or offline translation tasks.

6. Google Translate (GoogleTranslateCloudAPIFactory)

Integrates with the Google Translate Cloud API.

7. ChatGPT (ChatGPTFactory)

Integrates with the OpenAI API. Reads credentials from the Plone registry.


Installation and usage

Install this product as a dependency of your project: collective.translators

If you require AWS, Deepl, DeepSeek or Ollama support, install the product requiring the required extra:

  • collective.translators[deepl]
  • collective.translators[deepl,aws]

Google Translate and Libre Translate support is embedded because they just require HTTP requests to work.

Adding a New Tool

You can contribute a new translation tool (utility) by either:

  • Proposing it via a pull request (PR) within this package, following the structure below, or
  • Creating a separate Plone add-on package that provides an external translation utility implementing the same interface and registration pattern.

To add a new translation tool (utility) follow these steps:

  1. Implement and Register Your Utility

    • Your utility class must implement the IExternalTranslationService interface from plone.app.multilingual.interfaces.
    • It should provide at least these methods:
      • is_available(): Returns True if the service is enabled and ready.
      • available_languages(): Returns a list of supported language codes or pairs.
      • translate_content(content, source_language, target_language, ...): Performs the translation and returns the translated text.
    • Register your utility in its configure.zcml using:
      <utility
          provides="plone.app.multilingual.interfaces.IExternalTranslationService"
          name="your_tool_name"
          component=".utility.YourTranslator"
      />
      
    • Follow the structure and API of the existing utilities (see utility.py and configure.zcml in other tool folders) to ensure compatibility.
  2. Register Your Tool

    • In src/collective/translators/configure.zcml, add:
      <include package=".mytool" />
      
  3. (Optional) Create a Control Panel

    • If you want user-configurable settings for your tool, add:
      • A registry interface in interfaces.py.
      • Registry configuration defaults in profiles/default/registry/youtool.xml
      • Add ontrolpanel registration in profiles/default/controlpanel.xml
      • A control panel form and adapter in controlpanel/controlpanel.py, and register it in the relevant ZCML and controlpanel/configure.zcml.
    • See the existing tools for concrete examples of each file and configuration.
  4. Test Your Tool

    • Restart your site, access your tool's control panel, add your API key or settings, and test translation.

Refer to the code of existing tools (e.g. DeepL, AWS, LibreTranslate, DeepSeek, Ollama, Google) for examples of each file and configuration.

Contribute

License

The project is licensed under GPLv2.

Download files

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

Source Distribution

collective_translators-1.0.0a0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

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

collective_translators-1.0.0a0-py3-none-any.whl (48.6 kB view details)

Uploaded Python 3

File details

Details for the file collective_translators-1.0.0a0.tar.gz.

File metadata

  • Download URL: collective_translators-1.0.0a0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.14

File hashes

Hashes for collective_translators-1.0.0a0.tar.gz
Algorithm Hash digest
SHA256 f8ccc6907b4d9583c3d29c7579e9537385ddbd3d306a3705749d823c7b95a8d3
MD5 9196f131a98320b3e102801616a11a2b
BLAKE2b-256 a4d7bde6d3384ba7a50e76409d1d39aac6f59bfd0d3bacc12359247a557ead42

See more details on using hashes here.

File details

Details for the file collective_translators-1.0.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for collective_translators-1.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 547f2af93c5bdfbb49d9b18695af43680c583cf5fd2550e11a7641a7378255bd
MD5 1b3d94cd37dc99865c07ceeaf232c732
BLAKE2b-256 d2f284cfca3196d1f072f5192553af9660479266009a098d62ba00fd0bf4a9f2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0a0 This release

2 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