Connector settings

All connector settings live in one Django setting, PONYGLOT, a dictionary. Only API_KEY is required.

import os

PONYGLOT = {
    "API_KEY": os.environ["PONYGLOT_API_KEY"],
    "SOURCE_LANGUAGE": "en",
    "EXCLUDE_MODELS": ["shop.InternalNote"],
    "NOTIFY_EDITORS": True,
    "SITE_URL": "https://www.example.com",
    "DJANGOCMS": {
        "MODELS": ["cms.pagecontent", "djangocms_stories.postcontent"],
    },
}

Core (ponyglot)

Apply to every adapter.

Key

Default

API_KEY

–

Required. The site’s API key from the dashboard (pg_…).

API_URL

https://api.ponyglot.app/v1

SOURCE_LANGUAGE

LANGUAGE_CODE

Must match the site’s source language in Ponyglot.

LANGUAGES

the codes in LANGUAGES

The languages the site can store.

EXCLUDE_MODELS

[]

Models never synced, e.g. ["shop.InternalNote"].

EXCLUDE_FIELDS

[]

Fields never synced, e.g. ["blog.Post.subtitle"]. A slug listed here is never set from a translated title.

FIELD_FORMATS

detected

Overrides a field’s format, e.g. {"blog.Post.lead": "html"} (see formats).

SLUG_SOURCES

the first title field

The field a translated slug follows, e.g. {"blog.Post.slug": "headline"}.

NOTIFY_EDITORS

False

Email when translations arrive: True for everyone who may apply suggestions, or a list of addresses (see Email editors about new translations).

SITE_URL

–

Your site’s address, e.g. https://example.com, for links in emails.

TIMEOUT

30

Seconds per API request.

BATCH_SIZE

50

Units per push request, at most 100.

Model names are app_label.ModelName, fields app_label.ModelName.field.

django CMS (PONYGLOT["DJANGOCMS"])

Key

Default

MODELS

all frontend-editable models

The content models to translate, e.g. ["cms.pagecontent", "djangocms_stories.postcontent"].

CONTENT_FIELDS

see below

The content model fields to translate, e.g. {"djangocms_stories.postcontent": ["title", "abstract"]}.

PLUGINS

–

Which plugin fields to translate, in the format of DJANGOCMS_TRANSLATIONS_CONF (below). These entries win.

USER

"ponyglot"

Username of the inactive user that authors translation drafts.

FETCH_AFTER_MINUTES

15

Without a sync round this long, the translations dialog fetches its content’s translations itself.

Content model fields by default: for pages, title, menu title, page title and meta description; for other models, their text fields except bookkeeping ones.

Plugin fields

By default, a plugin’s fields are read from its form, as editors see it (see How the connectors work). To choose them yourself, declare them per plugin, in PLUGINS or in djangocms-translations’ DJANGOCMS_TRANSLATIONS_CONF, which is read as is:

DJANGOCMS_TRANSLATIONS_CONF = {
    "TextPlugin": {"fields": ["body"]},
    "LinkPlugin": {"fields": ["name"], "text_field_child_label": "name"},
    "PicturePlugin": {"fields": ["caption_text"]},
}

Key

fields

Exactly these fields.

excluded_fields

All detected fields except these.

text_field_child_label

For plugins embedded in rich text (such as links in djangocms-text): this field is translated inside the sentence it appears in and written back to the plugin.

Field names can be JSON keys ("heading" means config.heading for djangocms-frontend) or dotted paths.

Admin (PonyglotAdminMixin)

Not a setting, but needed for the dialogs on parler and modeltranslation models: add ponyglot.translations_admin.PonyglotAdminMixin to their admins (see Add translation controls to the model admin).