It turns out there is one crucial step that needs to be taken to tell WPML how the custom block should be translated. The wpml-config.xml file (placed in the root of your theme/plugin) gives instructions to WPML on how to translate your custom block. So, in my case, I created a new wpml-config.xml file and added the following code. Once I went to WPML > Settings, the new xml file was automatically loaded and the next time I went to translate a page that uses my custom block, the strings were decoupled from their HTML markup.
<wpml-config>
<gutenberg-blocks>
<gutenberg-block type="hello-tools/blue-cta" translate="1">
<xpath>//div/figure/blockquote/p</xpath>
<xpath>//div/figure/cite</xpath>
</gutenberg-block>
</gutenberg-blocks>
</wpml-config>
Related Posts:
- How to work with multilingual sites using the full site editor and block themes?
- Issue with translation – Gutenberg
- How to translate multiple blocks within one plugin
- Add To Gutenberg Sidebar
- How to detect the usage of Gutenberg
- What is the advantage of ‘register_block_type’ (the PHP function) when creating custom blocks?
- Serialize custom block with InnerBlock
- What replaces wpColorPicker in Gutenberg?
- Gutenberg Range Control default from meta value
- Find all the places where a block type is used
- Why is the new Gutenberg editor so narrow, and how to make it wider?
- WP Blocks – Gutenberg – not rendering $content
- Why does the custom HTML block not preserve the HTML characters?
- Can’t get dynamic Gutenberg block to render on the frontend
- Gutenberg change/remove “Write your story” placeholder in custom blocks
- What’s the absolute minimum code that I need to create a dynamic block?
- How to make 2/3 width column in Gutenberg
- Change default colors in paragraph block settings
- Gutenberg Reusable Block of WordPress
- Add custom attributes to link in Gutenberg
- How do I add a Gutenberg editor to a custom options page
- Gutenberg not all editor text translated
- WPML Translated Term
- Custom Gutenberg Block: Excluding an allowed block from InnerBlock’s templateLock={‘all’}
- Determine if block has already been registered
- InnerBlocks breaks Flexbox and CSS Grid styles
- Is there a way to set the gutenberg color palette outside the theme?
- Gutenberg get withState variable in save function
- Theme localization in WPML – .mo file error [closed]
- Gutenberg block JavaScript localisation on Polyglots does not work
- Restrict heading level in Gutenberg block `core/heading`
- How do I disable or hide the Layout block setting in the Group block
- Cleaning up after block dismount
- I cant see Block Editor with v5.7
- How to update block attribute after format is applied?
- How to add a class to the link of the default Gutenberg Button block?
- How to identify what templates are being loaded in a block-based theme [closed]
- Check if current page is using blocks (Gutenberg) or is legacy
- How do I replace a audio gutenberg block to native audio wordpress
- Converting a theme to Gutenberg but some styles are missing in the front end [closed]
- React useEffect not work in frontend gutenberg blocks
- Gutenberg Block language translation does not work
- Display selected image in the MediaPlaceholder component
- ACF and Gutenberg block, how to use blocks without ?
- Submitting a block to the .org repo: do I submit compiled code, or source code? [closed]
- Add button to Block toolbar: toggleFormat is undefined
- In a block transform, how do I insert innerBlocks?
- What is the name of the user capability to read a reusable block?
- Gutenberg – Prevent Column Nesting in the Visual Editor
- How to remove whitespaces from source of posts created through WordPress Gutenberg editor
- WPML icl_register_string() throws fatal error but works [closed]
- Gutenberg blocks (block editor) with get_the_excerpt and get_the_content, using ACF
- Basic use of useState
- Sort Posts by Sticky then by Latest date using the Latest Posts Block
- Unwanted white space next to inputs added within `PluginDocumentSettingPanel` using “
- ToolbarDropdownMenu component missing from @wordpress/scripts package
- Gutenberg Custom Block Not Validating – Ideas?
- Gutenberg dynamic block render_callback gives null for $post
- Editing HTML structure of Gutenberg layout recent post?
- How to add srcdoc attribute to YouTube oEmbed in Gutenberg oEmbed Block
- Pass props / function to InnerBlocks
- Categories in Gutenberg
- Block editor: content resets to the previous state in “Edit as HTML” by clicking somewhere outside of the editing window
- Possible to add the title of a custom gutenberg block to the edit screen?
- Post Format Link using Guttenberg
- Why does Gutenberg adds 4 around blocks? And how to change this?
- admin_notices not shown
- Layout Settings in the new Gutenberg editor
- How to get blocks with same heigh in columns?
- Gutenberg: Issue trying to commit locally
- How to register multiple blocks
- How to edit post meta by post ID in Gutenberg
- How do I change bullet on categories block?
- Add a class to img of core/cover block
- Hide title block on edit screen in Gutenberg
- How can I disable fontSizes of the Paragraph block inside the Quote block with theme.json?
- Categories, tags and thumbnails panels are not visible in the Block editor’s post menu
- How to disable the Code Editor in Gutenberg?
- Enable Gutenberg Editor when editing tags
- How to position more than one item over an image in a Gutenberg WordPress block theme
- Some CSS classes missing when rendering the page with get_the_content()
- Error with RichText Component
- Rem font size is different in the frontend and block editor
- Add to Media Inserter Categories
- Get attributes from last block created
- How do I make the block editor use https by default?
- Custom Gutenberg block within column block selection and update issue
- WP Gutenberg – How to parse simple images?
- How to add button to Gutenberg Editing Toolbar in Wordress
- Restrict Block from having a Parent or Ancenstor Block
- Latest WordPress Version Changes to Block Editor Template
- Allowed blocks for core/column
- Detecting whenever a user types – in the Gutenberg editor, and checking if there is a preceding or succeeding – then converting both to an em dash
- what is the function of the view.js file?
- Detect whether a block has server-side render
- No aspect ratio selector in a custom block
- How do I load css in edit screens for the block builder?
- How do I add text or message above the featured image area in gutenberg for a CPT
- Block that displays post meta as nested block of Query Loop
- InnerBlocks adds any block and saves, but the editor doesn’t show child blocks on reload