Translate models in the admin

This guide shows how to translate app models, such as products or blog posts translated with django-parler or django-modeltranslation, from the Django admin: request translations, apply them, and keep an eye on the whole site.

Add the Ponyglot button to your admins

Add PonyglotAdminMixin to the admin of each translated model, before the library’s admin class. It works with parler’s TranslatableAdmin and modeltranslation’s TranslationAdmin or TabbedTranslationAdmin:

from django.contrib import admin
from modeltranslation.admin import TabbedTranslationAdmin
from ponyglot.translations_admin import PonyglotAdminMixin

from .models import Product


@admin.register(Product)
class ProductAdmin(PonyglotAdminMixin, TabbedTranslationAdmin):
    list_display = ["name", "sku", "price"]

The change page and the change list now have a Ponyglot translations button, with the number of translations waiting.

Apply translations on the change form

Translations arrive as suggestions: nothing is written to your data until you decide. On the object’s change page, each waiting translation is shown below its field:

A product's change form on the German tab: below the empty Name and Description fields, a Ponyglot suggestion with Apply and Reject buttons; above, "Ponyglot suggestions for German: 2" with Apply all.

Waiting German translations below their fields.

Apply puts the translation into the field (and a title’s slug into the slug field), Reject marks it. Edit the text if you like. Nothing is stored until you save the form; saving records your decisions, including your corrections.

Translate one object, or all objects of a model

Ponyglot translations on the change page opens the dialog for this object:

The dialog for "Pony mug": German has 2 translations to apply (Review, Apply) and French has texts missing (Translate).

Per language what to do next.

Translate

Requests the translation of the missing or outdated texts in this language.

Apply

Writes all waiting translations of this language into the object right away. Texts with QA errors are left out: review them first.

Review

Opens the waiting translations one by one under Ponyglot › Translation suggestions, with the source, the current translation and a diff.

The same button on the change list opens the dialog for all objects of the model: one Translate all missing for the whole model, and Apply per language.

The dialog for all products, per language.

All products at once.

If no sync ran in the last 15 minutes, opening a dialog fetches its translations first, and Fetch translations now is offered.

Use the translation dashboard

Ponyglot › Translation dashboard covers the whole site, top to bottom: per language what is missing or waiting; a link to the documents that need attention (below); every content type with its waiting translations; and, folded away, the recent jobs and syncs.

The translation dashboard with German and French rows, the last sync, the link Which documents need attention, the content types Posts and Products, the folded Jobs and syncs, and the buttons Translate all missing and Sync now.

The whole site in one place.

Translate all missing requests everything missing or outdated on the site; Sync now runs a full sync. Because these are site-wide, the dashboard needs its own permission: Can use the translation dashboard. Give it to the people who run translations for the site.

Find the documents that need attention

Translation dashboard › Which documents need attention lists every document with a gap, one column per language:

  • missing or outdated: not translated yet, or the source changed since;

  • to apply: translations waiting here; the link opens them in the review;

  • in a draft (django CMS): written into a draft, done once an editor publishes it;

  • held by QA: decide them in Ponyglot (the link opens the review queue there).

Pages come first (django CMS, then Wagtail), then the models. Filter by content type or language. The document’s name opens its dialog (django CMS: its status page). To close gaps for several documents at once, select them and choose an action: Translate the selected documents (with a language filter: only that language) or Apply their waiting translations. The page also says when changes are waiting for the next sync or couldn’t be sent. Each content type on the dashboard links to its documents.

Permissions

Action

Needs

Open an object’s or model’s dialog, translate

Change permission on the model

Apply or reject translations

Can change translation suggestion

Translation dashboard

Can use the translation dashboard