Global Configuration

Configure translation providers, API keys, and global defaults.

Configure Kirby Content Translator globally in your config.php file. This sets default configuration properties that apply to all plugin instances, including translation provider settings and default behavior for view buttons and sections.

Translation Provider

At least one translation provider must be configured for the plugin to perform translation tasks.

DeepL

Industry-leading machine translation with 500k free characters/month. Recommended for most projects.

AI Translation

Use your Kirby Copilot AI provider (OpenAI, Google, Anthropic, Mistral) for context-aware translations.

New in v3.9

Custom Function

Integrate any translation API with a custom PHP function.

Global Default 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']
        ]
    ]
]

Available View Button & Section Properties

For detailed descriptions of each 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).

Batch Concurrency 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:

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

Configuration Precedence

Global configuration serves as the foundation, with more specific configurations overriding global defaults:

  1. Global configuration (in config.php)
  2. Section configuration (in blueprint sections) & view button props (in blueprint buttons – Kirby 5+ only)

For example, the following global configuration sets defaults for fieldTypes and title, which can be overridden in blueprints:

config.php
return [
    'johannschopplich.content-translator' => [
        'fieldTypes' => ['text', 'textarea'], // Global default
        'title' => true, // Global default
    ]
]

In a blueprint, you can override these global defaults in both sections and buttons:

Blueprint Override
sections:
  contentTranslator:
    type: content-translator
    fieldTypes: # Overrides global
      - blocks
      - text
      - textarea
    # title: true inherited from global

buttons:
  content-translator:
    title: false # Overrides global config

Custom Plugin Translations

If you prefer to overwrite the default translations of the plugin, you can do so by adding translations for your language in the languages directory of your Kirby installation.

See the plugin's translations.php for the full list of translation keys.

For example, to change the translation of the import button to Synchronize in English, append the following translations array to the languages/en.php file:

languages/en.php
return [
    'code' => 'en',
    'name' => 'English',
    // ... Other language configuration
    'translations' => [
        'johannschopplich.content-translator.import' => 'Synchronize'
    ]
];