Global Configuration
Translation Provider
At least one translation provider must be configured. Pick a backend below – the strategy option selects which one runs.
AI Translation
Context-aware translation via the Kirby Copilot plugin (OpenAI, Anthropic, Google, Mistral).
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:
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']
]
]
]
For detailed descriptions of each shared property, see the View Button & Section Configuration page. All local properties can be defined globally.
label String
Custom label for the Content Translator view button or section.
import Boolean
Enable or disable content importing functionality entirely.
importFrom String
Controls import direction. Set to all to allow importing from any language to any language.
batch Boolean
Enable or disable batch translation (translating to multiple languages at once).
title Boolean
Include the model title in import and translation operations.
slug Boolean
Include the model slug in import and translation operations. The slug will be generated from the translated title.
confirm Boolean
Show confirmation dialogs before import or translation operations.
fieldTypes Array
Specify which field types to include in import and translation operations.
includeFields Array
Specify specific fields to include in import and translation operations.
excludeFields Array
Specify fields to exclude from the import and translation process.
kirbyTags Object
Configure selective translation of KirbyTag attributes (e.g., link text, image alt text).
systemPrompt String
Override the AI translation system prompt. Takes precedence over the global ai.systemPrompt config option.
strategy Mixed v3.11+
Selects the translation backend explicitly. Accepts a string preset, a closure, or a Strategy instance. Without this option the plugin defaults to DeepL (and falls back to the deprecated translateFn).
| Value | Resolves to |
|---|---|
'deepl' | DeepLStrategy – requires DeepL.apiKey |
'ai' | CopilotAIStrategy – requires the Kirby Copilot plugin |
Closure | Wrapped in CallableStrategy. Signature: fn (string $text, string $target, ?string $source): string |
Strategy | Used as-is – instance of JohannSchopplich\ContentTranslator\Translation\Strategy |
return [
'johannschopplich.content-translator' => [
'strategy' => 'deepl', // or 'ai'
]
];
return [
'johannschopplich.content-translator' => [
'strategy' => function (string $text, string $target, ?string $source): string {
return myTranslateApi($text, $target, $source);
},
]
];
use App\Translation\MyApiStrategy;
return [
'johannschopplich.content-translator' => [
'strategy' => new MyApiStrategy(),
]
];
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 4 translations are processed concurrently to avoid hitting API rate limits.
If you encounter DeepL API rate limit errors, you can reduce the concurrency by setting the batchConcurrency option in your global configuration. For example, to limit concurrency to 2:
return [
'johannschopplich.content-translator' => [
'batchConcurrency' => 2
]
]
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.
return [
'johannschopplich.content-translator' => [
'ai' => [
'systemPrompt' => 'You are a medical translator. Preserve clinical terminology and abbreviations.'
]
]
]