Translating a Polylang Site With an LLM API: Batching, Glossaries and a Review Step

To translate a Polylang site with an LLM API, let Polylang handle the languages and links. Use your own API key to send each post to the model as structured data. For a whole site, three controls matter: batching to manage cost, a glossary to keep terms consistent, and a review step before anything goes live.

Many setup guides stop at “paste your key and click Translate”. That’s fine for one page. It breaks down when you’ve got fifty pages, three languages and a client who notices that “checkout” became three different words.

I’m assuming you’ve already installed Polylang and set up your languages. If not, start with this guide to building a multilingual WordPress site with Polylang.

A translation plugin on top of Polylang is the easiest way to get all three controls. If you’d rather build your own, I’ll show you the key code too. The screenshots come from LATW AI Translation for Polylang, which I work on. Most tools in this category have the same settings, just under different names.

What Should a Polylang AI Translation Plugin Do?

Polylang doesn’t send your content to a language model. You’ll need an add-on or your own code for that. Here’s what to look for:

  • Server-side jobs. Translation should run in the background on your server, not in a browser tab you have to keep open. That matters for long posts and big batches.
  • Structured content. Gutenberg blocks, page-builder data, custom fields and SEO meta need to come back in the same structure, not as one blob of HTML.
  • Your own API key and engine choice. You pay the AI provider directly at their price, and you can switch models when prices or quality change.
  • Batch mode. For bulk jobs, look for support for the provider’s Batch API on every engine that offers one.
  • Glossary and site context. You need a place to enter fixed terms and a short description of your site and its tone.
  • Review status. You can create new translations as drafts or mark them “Pending review” instead of publishing them straight away.
  • Updates without overwrites. When you edit the original, the plugin translates only the changed text again.
  • A cost log. Look for tokens and cost per job so you can see the actual numbers.

I’ll walk through each of these in turn.

What Does the Pipeline Look Like?

There are five steps. Each one fixes a particular problem that crops up when you translate more than a few pages.

  1. Choose the posts, pages and target languages.
  2. Send each post to the model as JSON so HTML, page-builder data and URLs come back in the same structure.
  3. Use synchronous requests for small items and batch mode for bulk work.
  4. Give the model a glossary and a site description so the terms and tone stay consistent.
  5. Review the result as a draft or pending post, then publish it.

Step 1: Pick the Content and Languages in Bulk

For a whole site, start from a list so you can tick several items and send them as one job. Translating one post at a time from the editor is fine for testing.

Bulk translation list with four ceramics blog posts; three are selected with Polish and Czech ticked, above a Translate Selected button

Three posts are ticked for both Polish and Czech, so one click on “Translate Selected” queues six translations. The first post already has both translations.

Two habits help here:

  • Start where the traffic is: your top pages, product categories and the posts that bring in visitors. Old news posts can wait.
  • Translate one language first. Review it and adjust the glossary before you run the other languages. That way, problems you fix in round one won’t crop up again in round two.

Step 2: Send Structured Content, Not Copy-Paste

An LLM API returns whatever text you ask for. Send raw HTML and ask for “a translation”, and you’ll sometimes get broken tags, translated class names or a note at the top saying “Here is your translation:”.

It’s safer to send the translatable fields as JSON and ask for JSON back with the same keys. Be explicit in the prompt: tell the model to keep the structure and keys, and to leave all HTML tags, attributes, URLs, IDs and class names alone.

Here’s what a request for one post looks like:

{
  "title": "Wheel Throwing workshops",
  "excerpt": "Two hours at the wheel, clay included.",
  "content": "<p>Book a <strong>2-hour</strong> class with <a href=\"/workshops/\">Maia Ceramics</a>.</p>"
}

The model returns the same three keys, this time with Polish or Czech values. Your code then writes them into a new post and links it to the original.

In Polylang that takes two calls: pll_set_post_language() marks the new post as Polish, and pll_save_post_translations() saves the translation group.

// $source_id: the English post. $tr: the decoded JSON from the model.
$new_id = wp_insert_post( wp_slash( array(
    'post_type'    => get_post_type( $source_id ),
    'post_status'  => 'pending',
    'post_title'   => $tr['title'],
    'post_excerpt' => $tr['excerpt'],
    'post_content' => $tr['content'],
) ), true );

if ( ! is_wp_error( $new_id ) ) {
    pll_set_post_language( $new_id, 'pl' );

    $translations = pll_get_post_translations( $source_id );
    $translations[ pll_get_post_language( $source_id ) ] = $source_id;
    $translations['pl'] = $new_id;

    pll_save_post_translations( $translations );
}

pll_save_post_translations() replaces the whole group, so read the existing translations first, then add the new one. If you pass just the new pair, the post’s other languages lose their link to it.

wp_slash() is there because wp_insert_post() unslashes its input. Skip it and every backslash in the content disappears.

Step 3: Choose How Requests Are Processed

In Step 1, you batched your selection. Providers can batch requests too, and that is where you save money. Each provider offers a Batch API: you send in your requests, the provider processes them when it has capacity, and you pick up the results later.

OpenAI describes it as a service with lower costs and a clear 24-hour turnaround:

Better cost efficiency: 50% cost discount compared to synchronous APIs

That line comes from the OpenAI Batch API guide (checked November 2026).

Anthropic’s Message Batches API also cuts costs by 50 percent. According to the Anthropic batch processing documentation, most batches finish in less than an hour. If a batch doesn’t finish within 24 hours, it expires (checked November 2026).

Google’s Gemini API has its own Batch API at 50% of the standard cost. The documentation puts the target turnaround at 24 hours but says most jobs finish much sooner (checked November 2026).

Processing setting set to Batch (cheaper, delayed) with help text for Synchronous, Batch and Background modes, and a website description for a pottery studio

Processing is set to Batch. The help text explains when to use each mode, and the website description below it goes into every request.

Most tools that support batch processing offer three modes:

Mode Provider price Speed Use it for
Synchronous Full A minute or two Short items (terms, titles, strings) and testing your setup
Batch About 50% Often 10-60 minutes, up to 24 hours Bulk jobs and long posts where cost matters more than speed
Background Standard, or lower for some eligible requests Usually a few minutes Long posts when you need them soon (where the provider supports it)

Not every plugin batches requests the same way. Some tools batch only OpenAI and Claude requests and send Gemini requests synchronously. That’s a limit of the plugin, not of Gemini, so check which engines your tool batches.

Machine-translation services like DeepL and Google Translate charge per character and don’t offer a batch discount. Whatever tool you use, the jobs should run on the server through WP-Cron or a real cron job. That way, you can close your browser while a batch runs.

What Does a Batch Run Cost?

Here’s what a batch run would cost with your own API key, using OpenAI’s published prices (checked November 2026).

To get realistic token counts, a 1,100-word English blog post was translated into Polish and into Czech with GPT-6 Luna on a test site. Each language used about 1,900 input tokens (prompt, site description and source text) and about 2,700 output tokens.

That works out to roughly 1.7 input tokens and 2.4 output tokens per English word. The output count is higher because Polish and Czech use more tokens per word than English, and the JSON keys come back with the text.

For the example, take a site with 30 posts of 1,500 words each. Translating them into 3 languages gives you 30 × 1,500 × 3 = 135,000 words.

At the measured rates, that comes to about 230,000 input tokens and 325,000 output tokens.

OpenAI model (price per 1M tokens, input / output) Standard Batch
GPT-6 Luna (gpt-6-luna, $0.10 / $0.50) about $0.19 about $0.09
GPT-6.1 Terra (gpt-6.1-terra, $1.00 / $5.00) about $1.86 about $0.93
GPT-6.2 Sol (gpt-6.2-sol, $2.00 / $10.00) about $3.71 about $1.86

On all three models, output tokens cost five times as much as input tokens, so most of the bill comes from the translated text itself.

Your numbers will depend on the model, the language and how much markup your pages contain. For languages closer to English, such as Spanish or German, the output token count is usually lower.

Many plugins show a cost log for each job, so you can see what you actually spent after the first run. For a broader look at the cost of AI features on a WordPress site, see what adding AI to a WordPress site really costs.

If you build this yourself, start by writing the batch requests to a JSONL file (one request per line). Then upload the file, poll the batch status and use the custom_id to match each result to its post. Two lines from a file like that look like this:

{"custom_id": "post-153-pl", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-6-luna", "response_format": {"type": "json_object"}, "messages": [{"role": "system", "content": "Translate the JSON values from English to Polish. Return JSON with the same keys. Keep HTML tags and URLs unchanged."}, {"role": "user", "content": "{\"title\": \"Wheel Throwing workshops\", \"excerpt\": \"Two hours at the wheel, clay included.\"}"}]}}
{"custom_id": "post-153-cs", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-6-luna", "response_format": {"type": "json_object"}, "messages": [{"role": "system", "content": "Translate the JSON values from English to Czech. Return JSON with the same keys. Keep HTML tags and URLs unchanged."}, {"role": "user", "content": "{\"title\": \"Wheel Throwing workshops\", \"excerpt\": \"Two hours at the wheel, clay included.\"}"}]}}

Put both the post ID and the target language in the custom_id. Results don’t come back in the order you sent them, so that ID is the only way to match each translation to its post.

When a result comes back, decode it and save it with the Polylang code from Step 2.

Step 4: Ground the Model with a Glossary and Site Context

Batching brings the cost down. A glossary keeps brand names and labels consistent across pages. Without one, the model might translate “checkout” one way on the cart page and another in the footer. It might even turn the name of your product line into a common noun.

Glossary with four terms and their Polish and Czech translations: add to cart, checkout, free shipping and the brand name Maia Ceramics

A small glossary for a ceramics shop. The brand name maps to itself in every language. That tells the model to leave it alone.

Here’s what belongs in a glossary:

  • Brand and product names that must never change. Map each one to itself.
  • Interface labels your visitors click, like “add to cart”, “checkout” and “book a class”. These must match the labels in your theme and plugins.
  • Domain terms that have one correct translation in your niche, such as “stoneware” or “wheel throwing”.
  • A short description for each ambiguous term. “Button label, keep short” helps the model choose wording that fits.

Keep the glossary short. Twenty precise entries beat two hundred generic ones. If your tool supports CSV import and export, you can use the same glossary on a client’s second site.

The other half of grounding is the site description. It tells the model who the site is for and how it should sound. In the processing screenshot in Step 3, the description for the test site ends with: “Warm, informal tone. Address the reader as ‘you’. Keep product names in English.”

One or two sentences like this give the model a clear tone to follow and fix a lot of wording problems.

Editable translation prompt with strict rules and a JSON output format, ending with website context and glossary placeholders

An editable prompt. At translation time, the tool fills in the website context and glossary placeholders.

Send the site description with every request, along with just the glossary entries for the target language. If your tool lets you edit the prompt, keep the rules about JSON and HTML. Add your own rules below them.

Step 5: Add a Review Step Before Publishing

Modern language models translate well, and a glossary keeps the wording consistent. It’s still machine translation. Someone should read it before it goes live.

The cheapest way to add a review step is to change one setting: the status of new translations.

Status of new translations setting set to Pending review

With “Pending review”, every new translation waits in WordPress until an editor publishes it.

Look for “Draft” or “Pending review”. The nice thing about “Pending review” is how well it fits WordPress roles: an editor can find the queue under Posts or Pages, check a translation and then publish it.

A Short Review Checklist

You don’t need to read every sentence on every page. Focus on the places where a mistake costs the most:

  • Title and SEO meta. Is the title tag the right length in the new language? Polish and Czech text can run longer than English, and search results cut off title tags past roughly 60 characters.
  • Glossary terms. Search the page for your brand name and two or three key labels.
  • Buttons and calls to action. Does the translated text fit the button width in your page builder? Long translations can wrap or overflow.
  • Numbers, prices and units. Check the decimal separators, currency symbols and dates.
  • Links, slugs and menus. Internal links should point to translated pages wherever those exist. Check the new page’s slug, then add the page to the menu for that language in Polylang.
  • The first screen. Read the hero text and intro out loud. If the wording sounds off, adjust the site description and translate again.

Fix small errors by hand in the translated post. If the same error keeps coming up, fix it at the source. Add a glossary entry or a line to the site description so the next batch gets it right.

Keep Your Corrections When the Original Changes

There’s a catch with those hand corrections. If you later edit the English post, re-translating the whole page would wipe out your fixes. Check how your tool handles outdated translations.

Outdated Translations setting set to Translate only changed strings, with help text explaining the update options

The Outdated Translations setting. Translating only the changed strings lets you keep the corrections you made by hand.

Good tools give you up to three options:

  • Translate only changed strings. Anything that hasn’t changed keeps its existing translation, including any fixes you made by hand. This is also the cheapest option.
  • Changed strings with the whole page as context. The wording fits the rest of the page better, but you pay the provider for that extra context on every update.
  • Re-translate from scratch. This replaces everything, including your fixes.

Two details are easy to miss. First, a “translate again” button often re-translates the whole post, no matter which update setting you chose.

Second, the review status usually applies only when you create a translation. If you update a translation that’s already published, it stays published. After a large rewrite of a source page, take another look at the updated translation.

FAQs

Here are some common questions about translating a Polylang site with an LLM API:

Can Polylang translate content with an LLM by itself?
No. Polylang manages languages, translation links and the language switcher. The call to the language model comes from a translation plugin or from your own code, which then saves the result as a linked Polylang translation.
How much does it cost to translate a WordPress site with the OpenAI API?
In the worked example above, 30 posts of 1,500 words in three languages cost about $0.09 to $1.86 in batch mode, depending on the model. Your cost depends on the model, the language and the markup in your pages.
When should I use batch mode instead of synchronous requests?
Use batch mode for bulk jobs and long posts, where cost matters more than speed. Use synchronous requests for short items such as titles and strings, and while you test your setup, because the result comes back within a minute or two.
Do I need a glossary for AI translation?
For more than a few pages, yes. A short glossary keeps brand names unchanged and makes labels such as "checkout" read the same on every page. Twenty precise entries are enough to start.
Will updating the English post overwrite my corrections in the translation?
Not if the tool translates only the changed strings. Unchanged text keeps its existing translation, including your hand fixes. Re-translating from scratch, or using a "translate again" button, replaces the whole post.
Should I publish machine translations without review?
It is safer not to. Create new translations as "Pending review" and check the title, SEO meta, glossary terms, buttons, prices and links before an editor publishes them.

Summary

Polylang handles the structure of a multilingual site, and an LLM API handles the words. Between the two you need three controls.

For bulk work, batch mode cuts the provider bill in half. A glossary and a site description keep terms and tone consistent across pages. A review status keeps each page from going live until someone has read it.

Start with one language and your top pages. After the first run, check the cost log. Whenever a reviewer fixes the same term twice, add it to the glossary.

Summarize with AI Claude ChatGPT Google AI
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!