Skip to content

Gutenberg blocks ​

WP Clinic Translator extracts text from core Gutenberg blocks and lets you translate it from the central Translations hub.

Classic editor ​

Pages saved as plain HTML (no block comments) are also scanned. Paragraphs, headings, and list items are registered with keys like block:{post_id}:classic.0:innerHTML.

Supported blocks (v0.2) ​

BlockWhat is translated
ParagraphText in the block
HeadingHeading text
ButtonButton label (text attribute)
Quote / PullquoteQuote text
List itemItem text
Cover, Media & TextTitle and description attributes

Nested blocks (groups, columns) are scanned recursively.

Workflow for editors ​

  1. Create or update your page in the default language (e.g. Dutch)
  2. Save the page — block strings are registered automatically
  3. Open WP Clinic Translator → Translations → Gutenberg
  4. Choose the target language (e.g. English)
  5. Fill in translations and click Save translations
  6. Open the page under /en/... to preview

Bulk import ​

Click Scan Gutenberg content on the Translations page to register block text from your 50 most recently updated posts and pages.

Tip ​

If a block does not appear, view the page once on the frontend in the default language — that also registers block strings.

What Gutenberg does not cover yet ​

  • Full duplicate posts per language (linked translation pages) — planned
  • Third-party block plugins — use developer hooks below
  • ACF fields — out of scope for now

For developers ​

Register extra blocks that store copy in innerHTML:

php
add_filter( 'wpc_translator_gutenberg_inner_html_blocks', function ( array $blocks ): array {
    $blocks[] = 'my-plugin/custom-block';
    return $blocks;
} );

Add custom extracted segments:

php
add_filter( 'wpc_translator_gutenberg_segments', function ( array $segments, int $post_id ): array {
    $segments[] = [
        'item_key'   => 'block:' . $post_id . ':custom:hero',
        'field'      => 'innerHTML',
        'value'      => 'Hero headline',
        'block_name' => 'my-plugin/hero',
        'block_path' => '0',
        'context'    => 'gutenberg:' . $post_id . ':my-plugin/hero',
    ];
    return $segments;
}, 10, 2 );

Registry keys use the format block:{post_id}:{block_path}:{field}.

WP Clinic Translator