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 |
|
|---|---|---|
|
– |
Required. The site’s API key from the dashboard ( |
|
|
|
|
|
Must match the site’s source language in Ponyglot. |
|
the codes in |
The languages the site can store. |
|
|
Models never synced, e.g. |
|
|
Fields never synced, e.g. |
|
detected |
Overrides a field’s format, e.g. |
|
the first title field |
The field a translated slug follows, e.g. |
|
|
Email when translations arrive: |
|
– |
Your site’s address, e.g. |
|
|
Seconds per API request. |
|
|
Units per push request, at most 100. |
Model names are app_label.ModelName, fields app_label.ModelName.field.
django CMS (PONYGLOT["DJANGOCMS"])¶
Key |
Default |
|
|---|---|---|
|
all frontend-editable models |
The content models to translate, e.g. |
|
see below |
The content model fields to translate, e.g. |
|
– |
Which plugin fields to translate, in the format of |
|
|
Username of the inactive user that authors translation drafts. |
|
|
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 |
|
|---|---|
|
Exactly these fields. |
|
All detected fields except these. |
|
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).