Download the PHP package el-schneider/statamic-magic-translator without Composer

On this page you can find all versions of the php package el-schneider/statamic-magic-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-magic-translator

Statamic Magic Translator

Translate Statamic entry content across multi-site localizations using LLMs or DeepL — with full support for Bard, Replicator, Grid, and deeply nested content structures.

Features

Installation

Publish the configuration:

CP Usage

Translating a single entry

  1. Open an entry in the control panel
  2. Click Translate in the sidebar
  3. Select target locales and options
  4. Click Translate selected

Each locale shows its own progress indicator. Failed translations display the error inline with a retry button.

Bulk translation

  1. Select entries in a collection listing
  2. Choose Translate from the actions menu
  3. Pick target locales and options in the dialog

Translation dialog options

Option Description
Source locale Defaults to origin entry. Can be changed to translate from any existing localization.
Generate slugs Auto-generate slugs from the translated title.
Overwrite existing When disabled (default), locales with existing translations are unchecked to prevent accidental overwrites.

Staleness badges

The Sites panel in the sidebar shows translation status per locale:

CLI Usage

The addon also ships with an artisan command for bulk and automated translation:

Requires at least one filter: --to, --collection, --entry, or --blueprint.

Common examples

Preview what would be translated for a collection (safe, no changes):

Translate all missing pages entries into German and French asynchronously:

Re-translate stale entries for CI/cron:

Translate one specific entry to every site its collection supports:

Options

Option Description
--to=* Target site handle (repeatable). Default: all sites each entry supports minus source site.
--from= Source site handle. Default: entry origin site.
--collection=* Filter by collection handle (repeatable).
--entry=* Filter by entry ID (repeatable).
--blueprint=* Filter by blueprint handle (repeatable).
--include-stale Also re-translate entries where source was updated after target last_translated_at.
--overwrite Re-translate everything regardless of existing state.
--generate-slug Slugify translated title.
--dispatch-jobs Dispatch queued jobs instead of running synchronously.
--dry-run Print the plan without executing.
-n, --no-interaction Skip confirmation prompt (required in CI/non-interactive environments).

Exit codes

Code Meaning
0 Success, dry run, empty plan, or user-declined confirmation.
1 Partial failure (some translations failed).
2 Command-level error (invalid options/handles, unsafe non-interactive run without -n).

Configuration

1. Exclude blueprints (optional)

By default, the addon auto-injects its fieldtype into entry blueprints. Use exclude_blueprints to opt out specific blueprints or whole collections:

2. Choose a translation service

Prism (LLMs)

Set your provider and model:

Any Prism-supported provider works — Anthropic, OpenAI, Gemini, Mistral, Ollama, etc. Just add the provider's API key to your .env and reference it in Prism's config.

DeepL

DeepL-specific options:

A DeepL glossary enforces your own terminology. Because a glossary is bound to a single language pair, set glossary for your main pair and add a per-language glossary under overrides for every additional target language. An override set to an empty string opts that language out of the global glossary.

Glossaries are matched on the target language only, so they assume a single source language. If you translate the same target from several source sites, configure the glossary for the pair you translate most and expect DeepL to reject the others.

If you already published config/statamic/magic-translator.php before upgrading, add 'glossary' => env('DEEPL_GLOSSARY_ID'), to its deepl array — Laravel merges published config shallowly, so DEEPL_GLOSSARY_ID alone has no effect.

3. Set up a queue worker

Control-panel translations and CLI runs using --dispatch-jobs execute asynchronously. You need a queue driver other than sync and a running worker:

Optionally configure a dedicated queue:

Content Structure Support

The addon handles all idiomatic Statamic content patterns:

Fieldtype Handling
Text, Textarea Translated as plain text
Markdown Translated as markdown (formatting preserved)
Bard Body text serialized with inline HTML tags, sets extracted recursively. Custom marks and extensions (e.g., Bard Texstyle) are preserved — the ProseMirror structure is never round-tripped through HTML.
Bard (raw markdown) Starter kit entries storing markdown instead of ProseMirror JSON are detected and translated as markdown.
Replicator Each set's fields are recursively extracted and translated.
Grid Each row's columns are recursively extracted and translated.
Table Each cell is translated as plain text.
Link text property is translated, url is preserved.
Assets, Toggle, Integer, Select, … Skipped (non-text fields are never translated).

Fields marked localizable: false in the blueprint are always skipped. Individual fields can be excluded with translatable: false in the field config.

Custom fieldtypes from an addon or your own project are skipped, because a plain string can just as easily be a colour swatch or an ID as a meta title. Opt one in by declaring what it holds:

Only plain and markdown can be declared. A fieldtype holding structured data cannot be opted in.

Deeply nested structures (Bard → set → Replicator → set → Bard → …) work to arbitrary depth.

Customizing Prompts

Translation prompts are Blade views. Publish them to customize:

This copies prompt templates to resources/views/vendor/magic-translator/prompts/.

Per-language prompt overrides

Different languages may need different instructions (e.g., formal "Sie" in German, polite form in Japanese):

Create the override views (e.g., resources/views/vendor/magic-translator/prompts/system-de.blade.php) with language-specific instructions.

Available prompt variables

Variable Example
$sourceLocale en
$targetLocale de
$sourceLocaleName English
$targetLocaleName German
$hasHtmlUnits true (Bard content present)
$hasMarkdownUnits true (Markdown fields present)

Events

Hook into the translation lifecycle:

BeforeEntryTranslation

Fired before extraction. Modify the $units array to exclude or alter translation units.

AfterEntryTranslation

Fired after translation, before save. Modify $translatedData to post-process the result.

Custom Translation Service

Implement the TranslationService contract to add your own backend (Google Translate, etc.):

Bind it in a service provider:

Requirements

License

MIT


All versions of statamic-magic-translator with dependencies

PHP Build Version
Package Version
Requires statamic/cms Version ^5.0 || ^6.0
prism-php/prism Version ^0.99 || ^0.100
deeplcom/deepl-php Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package el-schneider/statamic-magic-translator contains the following files

Loading the files please wait ...