---
title: "Machine Translation - PerfLocale"
description: "DeepL, Google Translate, Microsoft, and LibreTranslate integration with auto-translate on publish, block-editor translation, and usage limits."
canonical: "https://perflocale.com/features/machine-translation/"
source: "https://perflocale.com/features/machine-translation/"
format: "markdown"
---
# Machine Translation

Translate content instantly with leading MT providers, then refine with human review.

🇺🇸 English “Welcome to our bakery — we bake fresh bread daily.”

DeepL Google Microsoft LibreTranslate

🇩🇪 Deutsch via DeepL · best for European languages

“Willkommen in unserer Bäckerei — wir backen täglich frisches Brot.”

Lossless switch Swap providers anytime — translations already saved on your posts stay exactly as they are.

## Multiple Providers

Connect to DeepL, Google Translate, Microsoft Translator, self-hosted LibreTranslate, a custom external-agency endpoint, or — on WordPress 7.0+ — the WordPress AI Client. Switch providers anytime without losing existing translations.

Welcome to our bakery

We bake fresh sourdough every morning — come and try our award-winning artisan loaves.

Translate to

-    Deutsch
-    Français
-    Español

Publish

Drafts queued Translations land as drafts — ready for human review.

-   Deutsch empty
-   Français empty
-   Español skipped

## Auto-Translate on Publish

When you publish or create content, PerfLocale automatically sends it for machine translation. Results are saved as drafts for human review.

Monthly character budget

100,000 chars/month · resets in 12 days

47%

**47,200** used **52,800** remaining

Auto-stops at 100% — no overage charges.

Per-user hourly cap

Throttles runaway scripts before they spend

**500**/hour

-   Editor OK
    
    234 / 500 requests this hour
    
-   runaway-script.php throttled
    
    500 / 500 requests · further requests blocked for 47 min
    

Filterable via `perflocale/mt/rate_limit`

The hosted providers are reached over HTTPS; endpoints you supply yourself use the scheme you enter.

## Usage Controls

Set monthly character limits to control API costs. PerfLocale tracks usage and stops when the limit is reached. The hosted provider endpoints (DeepL, Google, Microsoft) are fixed HTTPS URLs; a self-hosted LibreTranslate or custom agency endpoint uses whatever URL you enter, so give it an HTTPS one. A per-user hourly cap (`500`/hour by default, filterable) protects your budget from runaway scripts.

 ![WordPress block editor with a paragraph block selected; the PerfLocale toolbar dropdown is open showing 'Fill in from source', 'Translate to English (UK)', 'Translate to German', 'Translate to French', 'Translate to Spanish', 'Translate to Arabic', plus 'Wrap in Show If Language' and 'Mark Do not translate'.](https://perflocale.com/assets/shots/04-block-editor-toolbar.png)

One menu, every action: translate to any active language, fill in from the source post, mark as ‘Do not translate’, or wrap in ‘Show if language’. In the standard Gutenberg toolbar — no separate translation panel

## Block Editor Integration

A PerfLocale dropdown in the Gutenberg block toolbar for paragraph, heading, quote, list item, button, and code blocks. Four actions on the selected block:

-   **Translate with MT** - send the block to any target language without leaving the editor. Backed by [`POST /block-translate`](https://perflocale.com/docs/rest-api/#block-translate).
-   **Fill in from source** - pull the matching block’s text straight from the source-language post, no provider call. Backed by [`POST /block-translate/from-source`](https://perflocale.com/docs/rest-api/#block-translate).
-   **Wrap in “Show If Language”** - turn the block into a language-conditional section in two clicks.
-   **Mark “Do not translate”** - flag the block as untranslatable; machine-translation preserves it verbatim and emits `data-perflocale-skip="1"` on the rendered HTML.

**WordPress AI Client** WP 7.0+

```
// Pick "WordPress AI Client" in
// PerfLocale → Settings → Addons
// → Machine Translation.
// PerfLocale routes every translation through
// whatever AI provider the host has wired up
// (OpenAI, Anthropic, local Ollama, …)
// — no new API key, no per-vendor settings.

// Override per-request:
add_filter(
  'perflocale/mt/wp_ai_client_args',
  fn( array $a ) => array_merge(
    $a,
    [ 'provider' => 'anthropic',
      'model'    => 'claude-opus-4-7' ]
  )
);
```

## WordPress AI Client Provider (WP 7.0+)

On WordPress 7.0 and later, the new **WordPress AI Client** provider delegates translation to whatever AI provider the host site already has configured under core's AI Client abstraction. No second API key, no separate billing dashboard — your translations and your other AI features share one provider.

The provider is feature-detected: it only appears in the dropdown when `wp_ai_client_prompt()` is available _and_ `wp_supports_ai()` returns true (so a host that disabled AI per-request via the `WP_AI_SUPPORT` constant or the `wp_supports_ai` filter is respected), or when a custom resolver is registered via `perflocale/mt/wp_ai_client_resolver`. The plugin's placeholder masker still gates every response so brand names and printf tokens survive the round trip — same integrity guarantee as DeepL / Google / Microsoft.

LLM-driven translation often handles idioms, register, and brand voice better than dedicated MT engines for marketing and long-form content; it's slower per call but reuses the AI quota you already pay for. See the [WP 7 hooks reference](https://perflocale.com/docs/hooks/#wp7-integrations) for prompt, args, and capability filters.

**WordPress Connectors API** WP 7.0+

```
// Already entered your DeepL key in
// another plugin's Connector?
// PerfLocale picks it up automatically.

// Priority chain:
//   1. environment variable
//   2. PHP constant (wp-config.php)
//   3. WordPress Connectors API   ← new
//   4. database (admin form)

// Extend to keys your own site registers
// (e.g. a GeoIP provider you wired up):
add_filter( 'perflocale/connectors/slug_map',
  fn( array $m ) => array_merge( $m, [
    'my_geo_provider_key' => 'my-geo-service',
  ] )
);
```

## Connectors API key sharing (WP 7.0+)

When WordPress 7.0's Connectors API is present, PerfLocale resolves MT API keys (DeepL, Google, Microsoft, LibreTranslate) through Connectors first — before falling back to the database value. Users who've already registered their key in another plugin's connector reuse it without re-typing, and rotation happens in a single place.

Source priority stays predictable: **environment variable > PHP constant > Connectors API > database**. Empty connector values are treated as “not set” so an explicitly-defined-but-empty connector doesn't shadow a real DB value. The default map covers the four MT-provider keys, and it's filterable — so any additional key setting your site registers (a GeoIP provider token, a currency-feed key) can route through Connectors too.

[← Back to Features](https://perflocale.com/features/)
