DeepL

Translate via DeepL with native API support – tunable request options, language-code overrides, and a free tier.

DeepL is a machine translation service with a focus on European languages; see its language list for what it covers. DeepL offers a free tier – see DeepL API pricing for current limits.

Setup

To translate with DeepL, add your API key to the global configuration:

site/config/config.php
return [
    'johannschopplich.content-translator' => [
        'DeepL' => [
            'apiKey' => 'your-deepl-api-key'
        ]
    ]
];
The plugin automatically detects whether you're using a free or pro API key and uses the appropriate endpoint.

Request Options

Pass any of DeepL's translate text parameters through requestOptions:

site/config/config.php
return [
    'johannschopplich.content-translator' => [
        'DeepL' => [
            'requestOptions' => [
                // Lean towards formal language
                'formality' => 'more'
            ]
        ]
    ]
];
text, source_lang, and target_lang are ignored here – the texts and languages of the current translation always win. Use targetLanguageOverrides to pin a target code.

Supported Languages

The plugin mirrors DeepL's supported languages.

Regional variants exist as target languages only:

  • German: Germany (DE-DE), Switzerland (DE-CH)
  • English: British (EN-GB), American (EN-US)
  • French: France (FR-FR), Canada (FR-CA)
  • Portuguese: Brazilian (PT-BR), European (PT-PT)
  • Spanish: European (ES), Latin American (ES-419)
  • Chinese: Simplified (ZH-HANS), Traditional (ZH-HANT)
Regional variants resolve from your Kirby language code first, then from its LC_ALL locale. A language code of de-ch receives DE-CH, and so does a plain de with the locale de_CH.UTF-8. The code wins when the two disagree, so a Swiss site keeps Swiss German on a server that only has de_DE installed.

Language Code Overrides

When your Kirby language code names no language DeepL supports, translating into it fails with Cannot resolve a DeepL target language – its locale can only sharpen the code into a regional variant, never stand in for it. A cn language therefore stays unresolvable on a zh_CN.UTF-8 server; map the code to a DeepL target code instead:

site/config/config.php
return [
    'johannschopplich.content-translator' => [
        'DeepL' => [
            'targetLanguageOverrides' => [
                // Kirby language code => DeepL target code
                'cn' => 'ZH-HANS',
                'no' => 'NB'
            ]
        ]
    ]
];

An override outranks both the language code and the locale, and isn't checked against the supported languages – so it also carries a code DeepL releases after this version.