Add translation controls to the model admin

This setup is for the developer who maintains your Django project. Once it is done, editors can follow Translate models in the admin without changing code.

Before you start

Install the connector for django-parler or django-modeltranslation. Your models must already be registered with that translation library and have working admins.

Add the buttons

Add PonyglotAdminMixin before the translation library’s admin class in each existing admin. For a modeltranslation product admin:

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

Keep your model’s own fields and admin options. Update its existing registration rather than registering it twice. With parler, use parler.admin.TranslatableAdmin as the second base class; modeltranslation’s TranslationAdmin also works.

Reload the admin after deploying the change. Both the object’s change form and the model’s change list should have a Ponyglot translations button.

Give editors access

Use Django’s user or group permissions:

Action

Permission

Open an object’s or model’s dialog and request translations

Change permission on the model

Apply or reject suggestions

Can change translation suggestion

Translate or sync across the whole site

Can use the translation dashboard

These are permissions on your Django site, separate from roles in the Ponyglot Cloud organization. Check the buttons using an editor account with the intended permissions.

Keep translations arriving

Set up Run the sync to send source changes, fetch translations and report editors’ decisions. You can also Email editors about new translations when suggestions arrive.