LocalePro
Menu

How it works

What happens between a request and a translated page.

LocalePro is a PHP plugin that translates the finished HTML of a page on your own server, saves each sentence in your database, and calls a translation provider only for sentences it has not seen. This page walks through each step, including the parts we have not finished.

Request flow

Six steps, all on your server.

  1. 1

    WordPress renders the page

    Your theme and plugins build the page exactly as they do today. LocalePro opens an output buffer at template_redirect and waits for the finished HTML. It does not change how posts are stored or queried.

  2. 2

    The HTML is parsed, not pattern-matched

    The finished page goes through WordPress's own WP_HTML_Tag_Processor. Text nodes and a short list of attributes (alt, title, placeholder, aria-label, meta description) are collected. No regular expressions run over the markup.

  3. 3

    Sentences are grouped with inline markers

    A sentence that contains a link or bold text is kept as one sentence. Each inline tag is replaced by a numbered marker, so the provider sees the whole sentence and the href, class, and tracking attributes stay on your server. If the markers come back out of order or missing, the sentence is rejected and the original is shown.

  4. 4

    Each segment gets an identity

    The source language, the normalised text, and its context are hashed with SHA-256. That hash is the key for everything that follows. Two identical sentences on different pages are one segment.

  5. 5

    Memory is checked first

    All hashes for the page are looked up in one pass against a request-local cache, then the WordPress object cache, then the wp_localepro_translations table. A page whose sentences have all been seen before is served from memory and never contacts a provider.

  6. 6

    Only misses go to the provider

    Sentences not in memory are sent to your DeepL, Google, or Microsoft account, up to 20 requests in parallel, with a 3-second timeout while a visitor is waiting. Results are written into memory and spliced back into the page through the same HTML API that read it.

The segmenter skips JSON, XML, and RSS bodies, and the plugin requires WordPress 7.0 for the HTML API it depends on. Pages served from a page cache or CDN are already translated; see caching and CDN for how invalidation is signalled.

What leaves your server

Segments go out. Your users' data does not.

The only outbound request LocalePro makes during a page view is to the translation provider you connected, and only when a sentence is missing from memory. Here is what is in that request, what is not, and the one case we have not closed yet.

Sent

The text of published, public pages: sentences with inline markers, the attributes listed above, and, for DeepL, a short context hint built from the page title and description. The hint is not translated or billed.

Never sent

Drafts, private posts, password-protected posts, previews, search results, 404s, and anything served in response to a POST. The request guard refuses these before a provider is considered.

Peeled out first

A notice like '"Blue mug" has been added to your cart' is stored as a template with the quoted value removed. The Interpolation_Peeler sends the skeleton once and puts the real value back on every render. Prices, currency symbols, ISO codes, and the terms you mark as keep-as-written are swapped for tokens before the request and restored after. If a token goes missing in the reply, the translation is refused.

Not yet excluded by default

Content shown only to logged-in users is translated like any other page today. If your site has account pages or members-only content, exclude those paths with the rules in Settings → Content, or restrict translation by post type. This gap is on our engineering list.

Exclusion rules →

LocalePro adds suggested text to WordPress's Privacy Policy guide naming the providers you have connected, so your policy can say where text is sent.

Where translations live

In tables you own, in formats you can leave with.

Your database

Segments and translations live in wp_localepro_segments and wp_localepro_translations, with slugs, page inventories, and import jobs in sibling wp_localepro_* tables. Standard dbDelta schema; standard mysqldump backups pick it all up.

Export any time

Tools → Export writes the whole memory as JSONL, CSV, or XLIFF 1.2. The same formats import back, with a dry run first. wp localepro memory export and import do the same from the command line.

Uninstall keeps your data

Deleting the plugin leaves the tables and options in place. Removing them is a setting you opt into before uninstalling, not the default.

What uninstall removes →

On the screen

Find a sentence, fix it, or leave it alone.

Search any sentence the site has translated and see its saved version.
Each page has its own panel: automatic, your own version, or off.

Keys and connections

Connect a translator once, in one place.

DeepL, Google, and Microsoft sit on WordPress's Connectors screen, next to the rest of your services.
Export translations as JSONL, CSV, or XLIFF, and import them back with a dry run first.

Provider layer

Three providers, one set of rules for failure.

Your own keys

DeepL, Google Cloud Translation, and Microsoft Translator, connected through the WordPress Connectors screen, an environment variable, or a wp-config.php constant. Keys are never sent to the browser and are redacted from logs. You are billed by the provider at the provider's price.

Fallback chain

Providers are tried in order. A language pair the first cannot handle, or a request it fails, passes to the next.

Circuit breaker

A provider that returns a quota, throttling, or availability error is paused: about a minute after a rate limit, longer after spent quota. The next provider answers meanwhile. An admin notice and a Site Health test say which one is paused and why.

QA rejection

A reply that returns the source unchanged, or is far shorter or longer than the sentence, is treated as a miss and sent to the next provider instead of being saved.

Spend ceiling

Set a monthly character limit. LocalePro warns at 80% and stops new provider calls at 100%. Everything already in memory keeps serving.

Staging never spends

On a site whose environment type is staging, development, or local, provider calls are refused even with production keys present, unless you allow it in settings or define LOCALEPRO_ALLOW_PROVIDER.

A page that fails partway through is served with the original text for the missing sentences and marked DONOTCACHEPAGE, so a half-translated page is never stored by a page cache. Details on limits and the staging guard are in usage and spend.

Caching

A warm page costs at most one query.

Translations are cached in two tiers: a request-local array, then the WordPress object cache, read with a single wp_cache_get_multiple call. Composed sentences are cached as recipes so the inline markers do not have to be re-applied from the database. On a page whose sentences are all in memory, the plugin issues at most one database query, and a test in CI fails if that budget is exceeded. With a persistent object cache such as Redis, a lock prevents several first visitors from translating the same page at once.

The licence

The key unlocks updates. Nothing else.

The licence key is checked by the in-dashboard updater when WordPress asks whether a new version exists and when it downloads the package. It is not consulted when a page is translated, when memory is read, or when you export.

If the key expires or you cancel, the plugin keeps running as it did the day before: pages translate, memory serves, and new sentences still go to your provider as long as your key for that provider works. What stops is updates from us. The key can be set in wp-config.php as LOCALEPRO_LICENSE_KEY for deployments that do not want it in the database. See the changelog for what each update changed.

Questions

Does LocalePro change how my posts are stored? +

No. There is one copy of each post, in wp_posts, as before. Translations are stored separately in wp_localepro_* tables and applied to the rendered page.

What happens on a page where every sentence is already translated? +

The hashes are looked up in the object cache and, on a cache miss, in one database query. No provider is contacted. Tests in CI fail if a warm page needs more than one query.

Does the licence key affect translation? +

No. The key unlocks plugin updates from our server. Translating, memory, export, and import all work without it. If the key lapses, the site keeps working and keeps translating; it stops receiving updates.

Is content for logged-in users kept private? +

Not by default yet. Content shown only to logged-in users is translated like any other page today. Exclude it with the rules in the content and exclusions documentation. Drafts, private posts, previews, and password-protected posts are never sent regardless.

What does the browser receive? +

The translated HTML. There is no client-side script that rewrites the page and no call from the visitor's browser to a translation service. The language switcher works without JavaScript.

Read the rest of the detail

The measured numbers, the SEO behaviour, and what is left behind on uninstall each have their own page.