Skip to content

Settings

All settings are namespaced under the TRADUIRE dictionary in your Django settings.

Reference

TRADUIRE = {
    # Dotted path to the translation backend class
    "BACKEND": "django_traduire.backends.deepl.DeepLBackend",

    # Source language code. Defaults to LANGUAGE_CODE.
    "SOURCE_LANGUAGE": "fr",

    # List of target language codes. Defaults to all LANGUAGES except source.
    "TARGET_LANGUAGES": None,

    # Auto-translate on model save. Default False.
    "AUTO_TRANSLATE": False,

    # Keyword arguments passed to the backend constructor.
    "BACKEND_OPTIONS": {
        "auth_key": "...",
    },
}

BACKEND

Dotted Python path to a class that extends django_traduire.backends.BaseBackend.

Built-in backends:

  • django_traduire.backends.deepl.DeepLBackend
  • django_traduire.backends.google.GoogleBackend
  • django_traduire.backends.openai.OpenAIBackend

SOURCE_LANGUAGE

The language code of your content. If None, defaults to settings.LANGUAGE_CODE (with any region suffix stripped: "en-us" becomes "en").

TARGET_LANGUAGES

A list of language codes to translate into. If None, uses all codes from settings.LANGUAGES except the source.

AUTO_TRANSLATE

When True, registers a post_save signal on all modeltranslation-registered models. Each save triggers automatic translation of empty fields.

BACKEND_OPTIONS

A dictionary of keyword arguments passed to the backend's __init__. Each backend has its own options — see Backends.