Skip to main content

Translation dashboard for wagtail-localize with caching

Project description

wagtail-localize-dashboard

A translation dashboard for Wagtail sites using wagtail-localize.

translation-dashboard

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
  • 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

# 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
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

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")

How It Works

  1. Database Table: The TranslationProgress model stores pre-calculated percentages
  2. Signals: Listen for translation changes and update TranslationProgress table automatically
  3. Dashboard: Displays TranslationProgress data for each page
  4. Management Command: Rebuilds TranslationProgress objects 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

  1. Clone the repository:
git clone https://github.com/lincolnloop/wagtail-localize-dashboard.git
cd wagtail-localize-dashboard
  1. 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

wagtail_localize_dashboard-0.1.2.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

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

wagtail_localize_dashboard-0.1.2-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_localize_dashboard-0.1.2.tar.gz.

File metadata

File hashes

Hashes for wagtail_localize_dashboard-0.1.2.tar.gz
Algorithm Hash digest
SHA256 56e7577eb883e3949b5e37ccad959d7356c27fb6449ea460b0da7f926929bcd0
MD5 9752c5fbf8d0887da07124a275e3a02c
BLAKE2b-256 ecc2e57f1087c80190363cd91784cb1b06a94faaef7f246adce90c0c3b172ca3

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_localize_dashboard-0.1.2.tar.gz:

Publisher: build.yml on lincolnloop/wagtail-localize-dashboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wagtail_localize_dashboard-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_localize_dashboard-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 071ecdc1d3bbec2155a28a843238eb2b28aaf4589cfeee5c20042d284c680264
MD5 7ce45b4302262a8cb3594ba607f48ee1
BLAKE2b-256 7173e6ec71f2138d2f7e2ee98d3842e12c5b44ec50655ccc0664f2ea1a1daaf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_localize_dashboard-0.1.2-py3-none-any.whl:

Publisher: build.yml on lincolnloop/wagtail-localize-dashboard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page