Translation dashboard for wagtail-localize with caching
Project description
wagtail-localize-dashboard
A translation dashboard for Wagtail sites using wagtail-localize.
Features
- Translation Dashboard: Visual overview of translation progress for all pages
- Auto-Updates: Signals automatically update percentages when translations change
- Performance: Translation percentages are stored in the database, for fast loading
- Filtering: Search by title, filter by language, translation key, or language group
- Color-Coded Status: Green (100%), Yellow (80-99%), Red (<80%)
- Admin Integration: Adds menu item to Wagtail admin
- Configurable: Enable/disable features via Django settings
Installation
pip install wagtail-localize-dashboard
Quick Start
1. Add to INSTALLED_APPS
# settings.py
INSTALLED_APPS = [
# ... other apps
"wagtail_localize",
"wagtail_localize_dashboard", # Add after wagtail-localize
# ... other apps
]
2. Include URLs
# urls.py
from django.urls import path, include
urlpatterns = [
# ... other patterns
path("translations/", include("wagtail_localize_dashboard.urls")),
# ... other patterns
]
3. Run Migrations
python manage.py migrate wagtail_localize_dashboard
4. Calculate Percentages
python manage.py rebuild_translation_progress
5. Access Dashboard
Navigate to /translations/ in your Wagtail admin, or click "Translations" in the admin menu.
Configuration
Customize behavior in your Django settings:
# settings.py
from django.utils.translation import gettext_lazy as _
# Enable/disable the entire feature (default: True)
WAGTAIL_LOCALIZE_DASHBOARD_ENABLED = True
# Enable automatic TranslationProgress updates via signals (default: True)
WAGTAIL_LOCALIZE_DASHBOARD_AUTO_UPDATE = True
# Track translation progress for Pages (default: True)
WAGTAIL_LOCALIZE_DASHBOARD_TRACK_PAGES = True
# Show dashboard in Wagtail admin menu (default: True)
WAGTAIL_LOCALIZE_DASHBOARD_SHOW_IN_MENU = True
# Menu item configuration (default label is translated via i18n;
# use gettext_lazy to keep it translatable when overriding)
WAGTAIL_LOCALIZE_DASHBOARD_MENU_LABEL = _("Translations")
WAGTAIL_LOCALIZE_DASHBOARD_MENU_ICON = "wagtail-localize-language"
WAGTAIL_LOCALIZE_DASHBOARD_MENU_ORDER = 800
# Items per page in dashboard (default: 50)
WAGTAIL_LOCALIZE_DASHBOARD_ITEMS_PER_PAGE = 50
# Column filter: group locales into named sets so users can filter
# which language columns are visible on the dashboard (default: [])
# Each tuple is (id, label, list_of_locale_codes).
WAGTAIL_LOCALIZE_DASHBOARD_COLUMN_FILTER_OPTIONS = [
("spanish", "Spanish", ["es-es", "es-ar", "es-mx", "es-cl"]),
("french", "French", ["fr-fr", "fr-ca", "fr-be"]),
]
When WAGTAIL_LOCALIZE_DASHBOARD_COLUMN_FILTER_OPTIONS is configured, a "Show languages" dropdown appears on the dashboard. Selecting a group limits the displayed language columns to the locales in that group. Rows are not hidden — pages with no translations in the selected group will still appear.
Usage
Dashboard
The dashboard shows:
- All original pages (not translations)
- Translation progress for each locale (0-100%)
- Color-coded status badges
- Quick links to edit pages
Management Commands
# Recalculate translation percentages for all pages
python manage.py rebuild_translation_progress
# Clean orphaned records and rebuild
python manage.py rebuild_translation_progress --clean-orphans
Programmatic API
from wagtail_localize_dashboard.utils import (
get_translation_percentages,
create_translation_progress,
rebuild_all_progress,
)
# Get translation percentage for a specific locale
from wagtail.models import Locale
page = Page.objects.get(id=123)
locale_de = Locale.objects.get(language_code="de")
percent = get_translation_percentages(page, locale_de)
# Update progress for a page
create_translation_progress(page)
# Rebuild all progress
stats = rebuild_all_progress()
print(f"Processed {stats['pages']} pages")
Internationalization (i18n)
All user-facing strings in the dashboard are translatable using Django's standard i18n framework. The package ships with English, Spanish, and Russian translations.
Adding a new translation
- Generate the
.pofile for your locale (e.g.frfor French):
cd wagtail_localize_dashboard
django-admin makemessages -l fr --no-wrap
-
Edit
locale/fr/LC_MESSAGES/django.poand fill in themsgstrvalues. -
Compile the translations:
django-admin compilemessages -l fr
- Restart the dev server to pick up the new translations.
Updating translations after code changes
If you add or change translatable strings, re-run makemessages for each locale:
cd wagtail_localize_dashboard
django-admin makemessages --all --no-wrap
django-admin compilemessages
How It Works
- Database Table: The
TranslationProgressmodel stores pre-calculated percentages - Signals: Listen for translation changes and update
TranslationProgresstable automatically - Dashboard: Displays
TranslationProgressdata for each page - Management Command: Rebuilds
TranslationProgressobjects when needed
Requirements
- Python 3.10+
- Django 4.2+
- Wagtail 5.2+
- wagtail-localize 1.8+
Contributing
Contributions are welcome!
Development
Setting Up for Development
- Clone the repository:
git clone https://github.com/lincolnloop/wagtail-localize-dashboard.git
cd wagtail-localize-dashboard
- Install the package with development dependencies:
pip install -e ".[dev]"
This installs the package in editable mode along with testing tools.
Running Tests
Run the test suite with pytest:
pytest
Run tests with coverage:
pytest --cov=wagtail_localize_dashboard
Run specific test files:
pytest tests/test_utils.py
pytest tests/test_views.py
Run accessibility tests (requires pip install -e ".[test,accessibility]"):
pytest -m accessibility
Code Quality
Check code with ruff:
ruff check .
Format with ruff:
ruff format .
Release
In order to make a release, we add a git tag and push it to GitHub. We have a GitHub Action that releases the code to PyPI when we add a new tag.
License
MIT License - see LICENSE file for details.
Credits
Created by Lincoln Loop for the Wagtail community.
Inspired by the translation dashboard in the Springfield CMS.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagtail_localize_dashboard-0.3.0.tar.gz.
File metadata
- Download URL: wagtail_localize_dashboard-0.3.0.tar.gz
- Upload date:
- Size: 37.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c95b99bcd8331ff7138c961788a2da64d9ca92cf38a39d0acdf2f9361b2f2261
|
|
| MD5 |
595b2deb9ebb4eb7936a4f6aa4940a36
|
|
| BLAKE2b-256 |
e3f2cd60b5fbaf933f05d69400162ea9615be734c4944680eeca9b6c555fb716
|
Provenance
The following attestation bundles were made for wagtail_localize_dashboard-0.3.0.tar.gz:
Publisher:
build.yml on lincolnloop/wagtail-localize-dashboard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_localize_dashboard-0.3.0.tar.gz -
Subject digest:
c95b99bcd8331ff7138c961788a2da64d9ca92cf38a39d0acdf2f9361b2f2261 - Sigstore transparency entry: 1042968140
- Sigstore integration time:
-
Permalink:
lincolnloop/wagtail-localize-dashboard@2ef6a12e9edfab585ec035da053fb7830ea56f8d -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/lincolnloop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@2ef6a12e9edfab585ec035da053fb7830ea56f8d -
Trigger Event:
push
-
Statement type:
File details
Details for the file wagtail_localize_dashboard-0.3.0-py3-none-any.whl.
File metadata
- Download URL: wagtail_localize_dashboard-0.3.0-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6209b92ff78b369a68070a9706b8547610aed2062d3b86ed2871257688a471d3
|
|
| MD5 |
08720fe613072b30c9c617a4d0befdad
|
|
| BLAKE2b-256 |
85cfbf90dcf2d905661901641de59ba69c963adcb0e4da5c9209ec482544164e
|
Provenance
The following attestation bundles were made for wagtail_localize_dashboard-0.3.0-py3-none-any.whl:
Publisher:
build.yml on lincolnloop/wagtail-localize-dashboard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wagtail_localize_dashboard-0.3.0-py3-none-any.whl -
Subject digest:
6209b92ff78b369a68070a9706b8547610aed2062d3b86ed2871257688a471d3 - Sigstore transparency entry: 1042968142
- Sigstore integration time:
-
Permalink:
lincolnloop/wagtail-localize-dashboard@2ef6a12e9edfab585ec035da053fb7830ea56f8d -
Branch / Tag:
refs/tags/0.3.0 - Owner: https://github.com/lincolnloop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@2ef6a12e9edfab585ec035da053fb7830ea56f8d -
Trigger Event:
push
-
Statement type: