level51/silverstripe-fluent-autotranslate

Module for auto translation using Google Translate or OpenAI for Silverstripe with Fluent

Installs: 2 362

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 2

Open Issues: 0

Type:silverstripe-vendormodule

0.3.1 2024-10-11 00:00 UTC

This package is auto-updated.

Last update: 2024-11-11 07:15:16 UTC


README

Module for auto translation using Google Cloud Translation for Silverstripe with Fluent.

Content

Requirements

Installation

composer require level51/silverstripe-fluent-autotranslate

Setup Google Cloud Translation API

Define the API key for the Google Cloud Translation API like this:

Level51\Autotranslate\AutotranslateFieldExtension:
    translation_provider: 'google' # 'google' or 'openai' (default: google)
    google_cloud_translation_api_key: 'YOUR_API_KEY'

See https://cloud.google.com/translate/docs/setup for setup instructions.

Setup OpenAI API

See https://platform.openai.com/docs/quickstart/create-and-export-an-api-key for setup instructions and how to get an API key.

Define the API key for the OpenAI API like this in your config.yml:

Level51\Autotranslate\AutotranslateFieldExtension:
  translation_provider: 'openai' # 'google' or 'openai' (default: google)
  openai_translation_api_key: 'YOUR_API_KEY'

For Open AI you can specify terms to avoid translation by adding them to the openai_translation_blacklist in the backend admin settings. If you want to use this feature you have to add the BlackListExtension to the SiteConfig class.

SilverStripe\SiteConfig\SiteConfig:
  extensions:
    - Level51\Autotranslate\BlackListExtension

Maintainer

Disable extension for specific field types

Level51\Autotranslate\AutotranslateFieldExtension:
  class_blacklist:
    - SilverStripe\Forms\HTMLEditor\HTMLEditorField