Wagtail Localize AI Translator
A machine translator for Wagtail Localize that uses Any-LLM for translation
Prerequisites
- Python 3.11+
- a Wagtail project with Wagtail Localize correctly configured
Dependencies
Installation
Install the package using pip:
pip install wagtail-localize-ai
In your settings.py file,
- Add
wagtail_localize_aito yourINSTALLED_APPS - Add
wagtail.contrib.settingsto yourINSTALLED_APPS(used to setup model and prompt) - Setup
WAGTAILLOCALIZE_MACHINE_TRANSLATORlike this:WAGTAILLOCALIZE_MACHINE_TRANSLATOR = { "CLASS": "wagtail_localize_ai.translator.AITranslator", }
Then, run python manage.py migrate wagtail_localize_ai to create the required database tables
Setting up providers
To set up providers add to your settings.py file a dict called AI_PROVIDERS.
Each entry is an arbitrary key identifying the provider instance, with a dict of configuration.
Reserved keys (all start with _):
_name: display name shown in the Wagtail admin_provider: any-llm provider name (e.g.openai,anthropic). Defaults to the entry key, so you can omit it when the key matches the provider name.
All other keys are passed as kwargs to AnyLLM.create(provider, **kwargs).
You can find supported providers and their kwargs in the any-llm documentation.
Having multiple instances of the same provider (e.g. different API keys or endpoints) is supported:
AI_PROVIDERS = {
"openai_main": {
"_name": "OpenAI (main)",
"_provider": "openai",
"api_key": "sk-...",
},
"openai_secondary": {
"_name": "OpenAI (secondary)",
"_provider": "openai",
"api_key": "sk-other-...",
"api_base": "https://my-proxy.example.com/v1",
},
}
Here are some examples for the most popular providers:
OpenAI
AI_PROVIDERS = {
"openai": {
"_name": "OpenAI",
"api_key": "sk-...",
"organization": "org-...", # Optional
"api_base": "https://api.openai.com/v1", # Optional
}
}
Anthropic
AI_PROVIDERS = {
"anthropic": {
"_name": "Anthropic",
"api_key": "sk-ant-...",
}
}
Azure OpenAI
Provider key: azureopenai (OpenAI-compatible Azure endpoint).
AI_PROVIDERS = {
"azureopenai": {
"_name": "Azure OpenAI",
"api_key": "...",
"api_base": "https://<resource>.openai.azure.com",
"api_version": "preview", # Optional, defaults to "preview"
}
}
Azure AI
Provider key: azure (Azure AI Inference SDK, for models deployed on Azure AI Foundry).
AI_PROVIDERS = {
"azure": {
"_name": "Azure AI",
"api_key": "...",
"api_base": "https://<model-deployment-name>.<region>.models.ai.azure.com",
}
}
Gemini
AI_PROVIDERS = {
"gemini": {
"_name": "Gemini",
"api_key": "...",
}
}
Vertex AI
Provider key: vertexai. project, location and credentials are passed directly to the Google GenAI client.
Using Application Default Credentials (e.g. gcloud auth application-default login):
AI_PROVIDERS = {
"vertexai": {
"_name": "Vertex AI",
"project": "my-gcp-project",
"location": "europe-west8",
}
}
Using a service account JSON file:
from google.oauth2 import service_account
AI_PROVIDERS = {
"vertexai": {
"_name": "Vertex AI",
"project": "my-gcp-project",
"location": "europe-west8",
"credentials": service_account.Credentials.from_service_account_file(
"/path/to/service_account.json",
scopes=["https://www.googleapis.com/auth/cloud-platform"],
),
}
}
Usage
You can set the provider, model and prompt from the AI Translator page reachable from the Settings menu entry.
You can also see the token usage from the Logs pagea in the Reports menu entry.
License
This project is released under the BSD license.
Contributors
Metadata
Release files for wagtail-localize-ai 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wagtail_localize_ai-0.3.2.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtail_localize_ai-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.3 kB
Release files / wagtail_localize_ai-0.3.2.tar.gz
| Download URL | wagtail_localize_ai-0.3.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc2f2347871996b87e56e1d4ec5029d6ccc38adccb385cdb8f3c95cc8749738a
|
|
BLAKE2b-256 checksum How to use checksums |
65ae50dda7cad37ac40bfac3df64586009579d3f9807397dbf3ea10aa7bd3f51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / wagtail_localize_ai-0.3.2-py3-none-any.whl
| Download URL | wagtail_localize_ai-0.3.2-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7555fc211e1117ba7ad618ca470ab0bb298d952b2fc4ae8edb3d674dcaa875db
|
|
BLAKE2b-256 checksum How to use checksums |
6bd10e3aaa31a52550fe2ceba392c4f88c10eec9de7a1aab964f50b909969c12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log