Global Configuration

Set the translation backend, credentials, and project-wide defaults in config.php – applies to every view button and section.

Translation Provider

At least one translation provider must be configured. Pick a backend below – the strategy option selects which one runs.

DeepL

Industry-leading machine translation with a free tier available.

AI Translation

Context-aware translation via the Kirby Copilot plugin (OpenAI, Anthropic, Google, Mistral).

Custom Strategy

Plug in any translation API via a closure or a custom Strategy implementation.

Available Properties

Set global defaults that apply to both view buttons and sections. These can be overridden in individual blueprints. The following configuration sets DeepL as the translation provider and defines global defaults for field types, title translation, slug translation, confirmation dialogs, and KirbyTags translation:

config.php
return [
    'johannschopplich.content-translator' => [
        // Translation provider
        'DeepL' => [
            'apiKey' => env('DEEPL_API_KEY')
        ],

        // Global default properties for view buttons and sections
        'fieldTypes' => [
            'blocks',
            'text',
            'textarea'
        ],
        'title' => true,
        'slug' => true,
        'kirbyTags' => [
            'link' => ['text', 'title'],
            'image' => ['alt', 'caption'],
            'file' => ['text', 'title']
        ]
    ]
]

import, importFrom, batch, title, slug, confirm, fieldTypes, includeFields, excludeFields, and kirbyTags can be set here as project-wide defaults; all of them are described on the View Button & Section Configuration page. Two blueprint properties have no global counterpart: systemPrompt becomes ai.systemPrompt, and label falls back to a Panel translation rather than a config value. Everything below exists only globally.

strategy Mixed v3.11+

Selects the translation backend explicitly. Accepts a string preset, a closure, or a Strategy instance. Without this option the plugin uses the deprecated translateFn if one is configured, and DeepL otherwise.

ValueResolves toPanel label
'deepl'DeepLStrategy – requires DeepL.apiKeyDeepL
'ai'CopilotAIStrategy – requires the Kirby Copilot pluginno provider dialog
ClosureWrapped in CallableStrategy. Signature: fn (string $text, string $target, ?string $source): stringCustom
StrategyUsed as-is – instance of JohannSchopplich\ContentTranslator\Translation\StrategyCustom

The Panel follows this option: a closure or Strategy instance enables the translation buttons without a DeepL.apiKey, and 'ai' makes Copilot the only provider on offer – with a single provider there is nothing to pick, so no dialog renders. When both are available, the AI toggle carries the name of the Copilot provider in use (Gemini, GPT (OpenAI), Claude, Mistral AI), falling back to AI (Copilot).

return [
    'johannschopplich.content-translator' => [
        'strategy' => 'deepl', // or 'ai'
    ]
];
See the Strategies reference for the full interface and built-in implementations.
The legacy translateFn option is deprecated and will be removed in v4. Migrate by renaming the key to strategy – the closure signature is identical.

batchConcurrency Integer v3.7.0+

In batch translation mode, multiple languages are translated in parallel to improve performance. By default, up to 2 translations are processed concurrently to avoid hitting API rate limits.

Lower it to 1 when the provider returns rate limit errors – the languages then translate one after another:

config.php
return [
    'johannschopplich.content-translator' => [
        'batchConcurrency' => 1
    ]
]

ai.systemPrompt String v3.10.0+

When using AI translation, you can replace the built-in system prompt with a custom one. Set it globally or override it per blueprint.

config.php
return [
    'johannschopplich.content-translator' => [
        'ai' => [
            'systemPrompt' => 'You are a medical translator. Preserve clinical terminology and abbreviations.'
        ]
    ]
]
See the AI Translation docs for the full default prompt, blueprint override examples, and usage details.
For configuration precedence and blueprint overrides, see the View Button & Section Configuration docs.