PHPackages                             s2hub/silverstripe-autotranslate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. s2hub/silverstripe-autotranslate

ActiveSilverstripe-vendormodule[Localization &amp; i18n](/categories/localization)

s2hub/silverstripe-autotranslate
================================

Auto Translate for SilverStripe CMS

v1.0.1(3mo ago)2304↑83.3%[1 issues](https://github.com/s2hub/silverstripe-autotranslate/issues)MITPHPPHP ^8.2CI passing

Since Apr 17Pushed 1mo agoCompare

[ Source](https://github.com/s2hub/silverstripe-autotranslate)[ Packagist](https://packagist.org/packages/s2hub/silverstripe-autotranslate)[ RSS](/packages/s2hub-silverstripe-autotranslate/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (16)Versions (3)Used By (0)

Silverstripe AutoTranslate
==========================

[](#silverstripe-autotranslate)

An extension for silverstripe/fluent to automatically translate content using AI services (ChatGPT, DeepL).

Installation
------------

[](#installation)

```
composer require s2hub/silverstripe-autotranslate
```

### Silverstripe CMS Versions

[](#silverstripe-cms-versions)

The current version of this module is for Silverstripe CMS 6.

Setup
-----

[](#setup)

### 1. Add the extension to your classes

[](#1-add-the-extension-to-your-classes)

```
# SiteTree already has fluent applied
SilverStripe\CMS\Model\SiteTree:
  extensions:
    autotranslate: S2Hub\AutoTranslate\Extension\AutoTranslate

My\Namespace\Model\Foo:
  extensions:
    fluent: TractorCow\Fluent\Extension\FluentExtension
    autotranslate: S2Hub\AutoTranslate\Extension\AutoTranslate
  # if you have a manual `translate` config on this class, you must add these fields explicitly:
  translate:
    - IsAutoTranslated
    - LastTranslation
```

The `AutoTranslate` extension adds two fields to each locale:

- `IsAutoTranslated` – flag that editors can toggle to mark a translation as manually reviewed
- `LastTranslation` – timestamp of the last auto-translation

⚠️ Some extensions from other modules define `translated` config on a class. If that applies to your class, you must add `IsAutoTranslated` and `LastTranslation` to the `translate` list manually (see Troubleshooting).

### 2. Choose and configure a translation backend

[](#2-choose-and-configure-a-translation-backend)

Two backends are available: **ChatGPT** (default) and **DeepL**.

Set the active backend in your config or via environment variable:

```
S2Hub\AutoTranslate\Translator\TranslatableFactory:
  backend: DeepL  # or ChatGPT (default)
```

The environment variable `FLUENT_TRANS_BACKEND` takes precedence over the config value:

```
FLUENT_TRANS_BACKEND=DeepL

```

---

ChatGPT
-------

[](#chatgpt)

### API Key

[](#api-key)

```
CHATGPT_API_KEY=your-api-key

```

### Configuration

[](#configuration)

```
S2Hub\AutoTranslate\Translator\ChatGPTTranslator:
  gpt_model: gpt-4o-mini
  # %s will be replaced with the target locale name
  gpt_command: 'You are a professional translator. Translate the following text to %s language. Please keep the json format intact.'
```

### Customising the prompt dynamically

[](#customising-the-prompt-dynamically)

Add an extension to `ChatGPTTranslator` and implement `updateGptCommand`:

```
public function updateGptCommand(&$command, $locale)
{
    $command = 'Translate the following JSON to ' . $locale . '. Preserve the JSON structure.';
}
```

### Finding available GPT models

[](#finding-available-gpt-models)

In `ssshell` you can list models available for your API key:

```
$gpt = new S2Hub\AutoTranslate\Translator\ChatGPTTranslator(Environment::getEnv('CHATGPT_API_KEY'));
$gpt->getModels();
```

---

DeepL
-----

[](#deepl)

### API Key

[](#api-key-1)

```
DEEPL_API_KEY=your-api-key

```

### Enabling DeepL

[](#enabling-deepl)

```
S2Hub\AutoTranslate\Translator\TranslatableFactory:
  backend: DeepL
```

or via environment variable:

```
FLUENT_TRANS_BACKEND=DeepL

```

### Locale mapping

[](#locale-mapping)

The module ships with locale mappings for 40+ languages in `_config/locales.yml`. DeepL uses different language codes than SilverStripe (e.g. `en_US` → `EN-US`, `de_DE` → `DE`). Override or extend mappings in your project config if needed:

```
S2Hub\AutoTranslate\Translator\DeepLTranslator:
  source_locales:
    de_DE: DE
    en_US: EN
  target_locales:
    de_DE: DE
    en_US: EN-US
    en_GB: EN-GB
```

### Glossaries

[](#glossaries)

DeepL glossaries let you enforce consistent terminology (e.g. brand names, product terms). Create glossaries in your DeepL account, then map their IDs to DeepL target language codes in your config:

```
S2Hub\AutoTranslate\Translator\DeepLTranslator:
  glossaries:
    EN-US: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    DE: 'yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'
```

The key must match the **DeepL target language code** (not the SilverStripe locale). The glossary is applied automatically whenever a translation targets that language.

### HTML handling

[](#html-handling)

DeepL receives the SilverStripe field values as a JSON object. If a field value contains HTML markup, the translator automatically enables DeepL's HTML tag handling (`tag_handling: html`) to preserve markup structure. Plain text values are handled separately, with HTML entities decoded back after translation.

Large HTML content is split into chunks at block-level tag boundaries to stay below DeepL's 75 kB request limit.

---

Running translations
--------------------

[](#running-translations)

### CLI task

[](#cli-task)

```
sake tasks:FluentAIAutoTranslate --do_publish=1
```

#### Parameters

[](#parameters)

ParameterShortcutRequiredDescription`--do_publish``-p`yesSet to `1` to publish translated content. Requires `FluentVersionedExtension` on versioned objects.`--force_translation`noRe-translate everything, including content already marked as manually edited (`IsAutoTranslated=false`).`--locale_from``-l`noSource locale (defaults to the site's default locale).`--locales_to``-t`noSemicolon-separated list of target locales, e.g. `--locales_to="en_US;es_ES"`. Translates to all locales if omitted.```
sake tasks:FluentAIAutoTranslate --help
```

### CMS UI

[](#cms-ui)

The `AutoTranslate` extension adds an **Auto Translate** button to the CMS actions bar. The button is only shown when editing a record in the **default locale** – it is hidden for translated locales.

Requires the `s2hub/silverstripe-cms-popup` module, which provides the modal infrastructure.

Clicking the button opens a modal with four options:

OptionDefaultDescription**Target languages**all non-default locales selectedSelect which locales to translate to.**Publish after translation**onPublish the translated content immediately. Requires `FluentVersionedExtension` and the source record must be published.**Only translate new content**onSkip records where `IsAutoTranslated = false` (manually edited) or whose `LastTranslation` is newer than the source. Uncheck to force re-translation of everything.**Recursive**offAlso queue all child pages for translation (SiteTree only).The modal processes items one by one and displays per-locale feedback (translated, published, skipped, error) for each item as it completes.

**Owned objects** (e.g. Elemental blocks, Links, related media records) are always translated inline as part of the parent record – they do not appear as separate queue items. The *Recursive* option only controls whether child *pages* are added to the queue.

---

Translation behaviour
---------------------

[](#translation-behaviour)

- Translation always reads from the **default locale**.
- A record is skipped if `IsAutoTranslated = false` (manual edit detected), unless `force_translation` is set.
- A locale is skipped if its `LastTranslation` timestamp is newer than the source record's, meaning it was manually edited after the last auto-translation, unless `force_translation` is set.
- `IsAutoTranslated` is set to `true` and `LastTranslation` is updated after each successful translation.
- Publishing only works if the object uses `FluentVersionedExtension` instead of `FluentExtension`.

---

Troubleshooting
---------------

[](#troubleshooting)

### `[Emergency] Uncaught RuntimeException: My\Namespace\HomePage does not have IsAutoTranslated as translatable field`

[](#emergency-uncaught-runtimeexception-mynamespacehomepage-does-not-have-isautotranslated-as-translatable-field)

Your class defines a manual `translate` list. Add the required fields:

```
SilverStripe\CMS\Model\SiteTree:
  extensions:
    autotranslate: S2Hub\AutoTranslate\Extension\AutoTranslate
  translate:
    - IsAutoTranslated
    - LastTranslation
```

### DeepL API character limit reached

[](#deepl-api-character-limit-reached)

The task throws a `RuntimeException` when the DeepL character quota is exhausted. Check your usage in the DeepL account dashboard and upgrade your plan or wait for the quota reset.

---

Thanks to
---------

[](#thanks-to)

This module is based on the fluent-export-import-module by [wernerkrauss](https://github.com/wernerkrauss/silverstripe-fluent-export-import/). Thanks to [Nobrainer](https://www.nobrainer.dk/) and [Adiwidjaja Teamworks](https://www.adiwidjaja.com/) for sponsoring this module ❤️.

Thanks to TractorCow and all contributors for the great [fluent module](https://github.com/tractorcow-farm/silverstripe-fluent). And thanks to the folks at Silverstripe for their great work.

S2-Hub
------

[](#s2-hub)

This module is published and maintained by [S2-Hub](https://www.s2-hub.com). S2-Hub is a non-profit organisation that consists of Silverstripe CMS professionals and agencies around Europe with the goal of setting up a dedicated European professional hub for all things Silverstripe CMS.

See you on next [Stripecon](https://www.stripecon.eu)!

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance76

Regular maintenance activity

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

93d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64d979993815fa2d2ea95b3fd72b4f43e95a631ce569f4f1c0330786971b5fc2?d=identicon)[adiwidjaja](/maintainers/adiwidjaja)

---

Top Contributors

[![wernerkrauss](https://avatars.githubusercontent.com/u/1043925?v=4)](https://github.com/wernerkrauss "wernerkrauss (66 commits)")[![adiwidjaja](https://avatars.githubusercontent.com/u/280394?v=4)](https://github.com/adiwidjaja "adiwidjaja (16 commits)")[![Apilonius64](https://avatars.githubusercontent.com/u/103268036?v=4)](https://github.com/Apilonius64 "Apilonius64 (5 commits)")[![Zazama](https://avatars.githubusercontent.com/u/7694808?v=4)](https://github.com/Zazama "Zazama (1 commits)")

---

Tags

i18nsilverstripemultilingualfluentextension

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/s2hub-silverstripe-autotranslate/health.svg)

```
[![Health](https://phpackages.com/badges/s2hub-silverstripe-autotranslate/health.svg)](https://phpackages.com/packages/s2hub-silverstripe-autotranslate)
```

###  Alternatives

[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

91437.9k29](/packages/tractorcow-silverstripe-fluent)[mage-os/module-automatic-translation

Automatic AI content translation for Mage-OS.

3117.9k](/packages/mage-os-module-automatic-translation)[silverstripe/translatable

Allows translation of DataObject and SiteTree records into multiple languages

52199.3k8](/packages/silverstripe-translatable)[yeesoft/yii2-multilingual

Yii2 Multilingual Module

177.4k1](/packages/yeesoft-yii2-multilingual)[devgroup/yii2-multilingual

Allows building yii2 apps for multiple languages using regional URL's and domains

142.6k2](/packages/devgroup-yii2-multilingual)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
