Skip to content

Adds support for deepl.com translation to contao dca input fields

License

Notifications You must be signed in to change notification settings

guavestudios/DeeplBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deepl Bundle

Adds support for deepl translation API in DCA input fields.

Also supports Multilingual Data Container

Install

Install Contao bundle

composer require guave/deepl-bundle

Add deepl API key to .env

DEEPL_API_KEY=''

Install assets

if you use web as the document root, pass it as an argument

php vendor/bin/contao-console assets:install

Configuration

guave_deepl:
  enabled: true
  freeApi: true
  defaultLanguage: de
  tables:
    tl_content:
      fields:
        - title
        - text
      multiColumnFields:
        category_grid:
          fields:
            - title
            - text

Register Custom ActiveLanguageResolver

Register it with the tag deepl.resolver

# services.yml
services:
  # ...

  App\Resolver\ActiveLanguageByProductLanguageResolver:
    public: true
    tags:
      - { name: 'deepl.resolver', priority: 50 }
# src/Resolver/ActiveLanguageByProductLanguageResolver.php
<?php

namespace App\Resolver;

use Contao\DataContainer;
use Guave\DeeplBundle\Resolver\ActiveLanguageResolverInterface;

class ActiveLanguageByProductLanguageResolver implements ActiveLanguageResolverInterface
{
    public function supports(DataContainer $dataContainer): bool
    {
        // TODO: Implement supports() method.
    }

    public function resolve(DataContainer $dataContainer): ?string
    {
        // TODO: Implement resolve() method.
    }}
}

About

Adds support for deepl.com translation to contao dca input fields

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •