Basic Usage Examples

Common scenarios and workflows for using the Content Translator plugin.

Blueprint Configuration Examples

Basic Article Translation

pages/article.yml
sections:
  contentTranslator:
    type: content-translator
    label: Article Translator
    fieldTypes:
      - text
      - textarea
      - blocks
    title: true

Product Page with Selective Fields

pages/product.yml
sections:
  contentTranslator:
    type: content-translator
    label: Product Information
    includeFields:
      - title
      - description
      - features
      - specifications
    excludeFields:
      - price
      - sku
      - category

Documentation with KirbyTags

pages/docs.yml
sections:
  contentTranslator:
    type: content-translator
    label: Documentation Translator
    fieldTypes: [markdown, text]
    title: true
    slug: true
    kirbyTags:
      link: [text, title]
      image: [alt, caption]
      file: [text, title]

Global Configuration Examples

Basic Global Setup

config.php
return [
    'johannschopplich.content-translator' => [
        'DeepL' => [
            'apiKey' => env('DEEPL_API_KEY')
        ],
        'fieldTypes' => ['text', 'textarea', 'blocks'],
        'title' => true,
        'confirm' => false
    ]
];

Advanced Global Configuration

config.php
return [
    'johannschopplich.content-translator' => [
        'DeepL' => [
            'apiKey' => env('DEEPL_API_KEY'),
            'requestOptions' => [
                'formality' => 'more'
            ]
        ],
        'fieldTypes' => [
            'blocks',
            'layout',
            'text',
            'textarea',
            'writer'
        ],
        'kirbyTags' => [
            'link' => ['text', 'title'],
            'image' => ['alt', 'caption'],
            'file' => ['text', 'title'],
            'email' => ['text', 'title']
        ],
        'excludeFields' => [
            'seo_title',
            'meta_description',
            'date',
            'author'
        ],
        'title' => true,
        'slug' => true,
        'confirm' => false
    ]
];