guave / deepl-bundle
Adds support for deepl.com translation to contao dca input fields
Installs: 1 638
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 3
Type:contao-bundle
Requires
- php: ^7.4 || ^8.0
- contao/core-bundle: ^4.9
- guzzlehttp/guzzle: ^6.0 || ^7.0
- terminal42/dc_multilingual: ^4.0
Requires (Dev)
- roave/security-advisories: dev-latest
README
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. }} }