定制 guave/deepl-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

guave/deepl-bundle

最新稳定版本:1.0.22

Composer 安装命令:

composer require guave/deepl-bundle

包简介

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

README 文档

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.
    }}
}

统计信息

  • 总下载量: 2.47k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-03-04