kirbydesk / kirby-translatewizard
AI Translation for Kirby CMS
Package info
github.com/kirbydesk/kirby-translatewizard
Type:kirby-plugin
pkg:composer/kirbydesk/kirby-translatewizard
Requires
- getkirby/composer-installer: ^1.2
- kirbydesk/kirby-pagewizard: ^1.1.51
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
DeepL-powered translator for kirby-pagewizard.
Understands pagewizard's pwtext and pweditor JSON envelopes and
translates only their text payload, leaving alignment/level/size/mode
config untouched. Walks Blocks recursively so nested items
(pwsteplistitem, pwcardletsitem, pwfeaturelistitem, pwButton, …)
are translated too.
Besides the Blocks field, the page title and pagewizard's meta fields
(metapagetitle, metanavigationtitle, metateaser,
metadescription, metakeywords) are translated as well. On the first
translation, pages get a target-language slug derived from the
translated title. Once a language has its own slug it is never changed
again, so published URLs stay stable (home and error page keep their
slug; on a slug collision the current slug is kept).
Adds an AI button to page views in every secondary language with two actions:
- Translate page with AI — sends the default-language content through DeepL and writes the result to the current secondary language.
- Restore original language — copies the default-language content onto the current language 1:1 and drops the translated slug (destructive). Disabled until the language's content file exists.
Requirements
- Kirby 5
- kirby-pagewizard ^1.0
- A DeepL API key (free tier
xxx:fxor proxxx)
Installation
composer require kirbydesk/kirby-translatewizard
Or drop this repository into site/plugins/kirby-translatewizard/.
Configuration
DeepL API key
Register your DeepL API key in site/config/config.php:
return [ 'kirbydesk.translatewizard' => [ 'deepl' => [ 'apiKey' => 'YOUR-DEEPL-API-KEY', ], ], ];
The key ending in :fx triggers the DeepL Free endpoint; any other
value hits DeepL Pro.
Get an API key at https://www.deepl.com/pro-api. The DeepL Free tier allows up to 500,000 characters per month.
Note: translatewizard is not compatible with johannschopplich/kirby-content-translator. Use one or the other, not both.
Panel button
The actions live in the shared AI view button provided by
kirby-pagewizard (ai, requires kirby-pagewizard 1.1.51+). The button
only shows entries that make sense for the current view: the translate
actions appear in secondary languages only (Kirby's default language
cannot translate to itself). When kirby-contentwizard is installed too,
its entries are added below a separator.
Add the button to Kirby's panel.viewButtons config:
return [ 'panel' => [ 'viewButtons' => [ 'page' => ['open', 'preview', '-', 'settings', 'ai', 'languages', 'status'], 'site' => ['preview', '-', 'settings', 'ai', 'languages'], ], ], ];
This config only applies to blueprints that do not declare their
own buttons:. If a page blueprint declares its own list, add
- ai to it explicitly — Kirby always prefers the blueprint list over
the config default.
API
Direct HTTP endpoint (for scripting / CI):
POST /api/pages/(:all)/translatewizard/translate
Content-Type: application/json
{ "from": "de", "to": "en" }
Requires an authenticated Panel session.
Development
src/PwtextCodec.php— decode/encode for pwtext + pweditor envelopessrc/BlockWalker.php— path-based recursive walker over nested Blockssrc/DeepL.php— DeepL client (free/pro auto-detect, batched, splits html vs plain payloads to avoid&escaping in plain text)src/Translator.php— orchestrator: extract → translate → write backindex.php— Kirby plugin registration (options, area, dialogs, API route)index.js— Panel-side custom icon registration
License
Proprietary — internal Kirbydesk use.