Skip to content

Add seed_translations management command for DeepL#464

Draft
Raghaddahi wants to merge 2 commits into
mainfrom
translation
Draft

Add seed_translations management command for DeepL#464
Raghaddahi wants to merge 2 commits into
mainfrom
translation

Conversation

@Raghaddahi

@Raghaddahi Raghaddahi commented Jul 21, 2026

Copy link
Copy Markdown
Member

Description

Adds a Django management command to bulk-seed initial page translations into target locales using DeepL (via wagtail-localize's machine translator).

Useful for the first-time case where manually translating every page via the admin is tedious. The command automates the same steps the admin would do — create the target locale, copy the source page, run machine translation — and is idempotent for reruns.

Usage

python manage.py seed_translations --locale fr
python manage.py seed_translations --locale fr --page manage-snippets
python manage.py seed_translations --locale fr --subtree how-to

Notes

  • Pages are always saved as drafts (human review before publishing).
  • Target locales must be in WAGTAIL_GUIDE_LANGUAGES; the source locale (en) is rejected.
  • Translator comes from WAGTAILLOCALIZE_MACHINE_TRANSLATOR (provider-agnostic); currently configured for DeepL free tier.
  • DeepL-unsupported locales are skipped gracefully.
  • Idempotent: reruns skip existing pairs and don't double-bill DeepL (segments already translated are skipped).
  • Abort on translator failure.

AI usage

Code was written with AI assistance (opencode); the user reviewed and tested each step inline before committing. PR description drafted by the AI agent and reviewed by the user.

@Raghaddahi Raghaddahi changed the title Add seed_translations management command Add seed_translations management command for DeepL Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants