DEV Community

Cover image for Automating Long-Form Content Translation in WordPress with Chunked AI Processing
NEXU WP
NEXU WP

Posted on

Automating Long-Form Content Translation in WordPress with Chunked AI Processing

I built this plugin to solve a very specific WordPress problem: long WPML translation jobs tend to be the first thing to break when you try to automate them with AI.

Short posts are easy. A 4,000 word article, a dense WooCommerce product page, or an Elementor layout with mixed HTML is where things get messy. Token limits, partial responses, broken markup, and stalled background jobs turn "automatic translation" into a manual cleanup task.

My approach was to treat translation as a queue-driven processing pipeline instead of a single API call. The plugin watches WPML translation jobs, picks up items assigned to the AI translator, and sends them through a background worker powered by WordPress cron. That means editors can keep publishing while translations run asynchronously.

The key part is chunking. When content is too large, I split it at natural boundaries like paragraphs and sentence edges, not arbitrary character counts. Each chunk is translated independently, progress is saved after every successful step, and the final content is reassembled in order. If a request fails halfway through, the job resumes from the last completed chunk instead of starting over.

I also made sure the pipeline preserves HTML structure, so links, formatting, and layout content survive the round trip. That matters a lot for WPML sites translating landing pages, product descriptions, and builder-generated content.

Under the hood, the plugin supports multiple providers, including OpenAI, Claude, Mistral, and Grok, with model selection and batch controls exposed in the admin UI. There is also a queue dashboard for inspecting pending, completed, and failed jobs, plus retry and reset actions when something gets stuck.

The result is less about replacing WPML and more about removing the operational bottleneck around it. WPML still owns the multilingual workflow, while the addon handles the repetitive translation processing reliably in the background.

If you want to see the plugin itself, I published it here: NEXU WPML AI Translation Addon.

Top comments (0)