DEV Community

Cover image for Automating Builder Content Translation in WordPress with WPML and AI
NEXU WP
NEXU WP

Posted on

Automating Builder Content Translation in WordPress with WPML and AI

I built this plugin to solve a very specific WordPress problem: WPML handles multilingual structure well, but translating builder content, strings, templates, and long post bodies still turns into a queue of manual work.

The core idea was simple. Instead of replacing WPML, I hook into its translation job flow and process assigned jobs in the background through AI providers like OpenAI, Claude, Mistral, and Grok. The result is a translator layer that sits between WPML and the model API, then pushes completed content back into the normal WordPress workflow.

What made this interesting technically was not the API call itself. It was handling real site content safely. Builder layouts and rich post content contain HTML, shortcodes, structured fields, and sometimes very large payloads. I added chunking so long content is split at paragraph or sentence boundaries, translated in smaller requests, then reassembled in order. That keeps context intact while avoiding token and timeout issues.

I also built a queue system around WordPress cron. Jobs are detected from WPML, stored with status metadata, processed incrementally, and retried if something fails. If a request stalls halfway through, the plugin can resume from the last completed chunk instead of starting over. That matters when you are translating Elementor templates, WooCommerce product content, taxonomy terms, or WPML strings at scale.

Another part I cared about was preserving structure. The plugin keeps HTML and formatting stable so translated content does not come back with broken markup or mangled layout data. On top of that, I added a dashboard for queue visibility, retries, filtering, and basic translation stats, because background automation is only useful if you can inspect what it is doing.

So the plugin is really an orchestration layer for multilingual content operations in WordPress. WPML remains the source of truth for languages and jobs, while the addon automates the expensive part: turning pending translation work into completed content without constant editor involvement.

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

Top comments (0)