This topic contains 0 reply, has 1 voice.
Last updated by Kristof 1 month, 3 weeks ago.
Assisted by: Noman.
| Author | Posts |
|---|---|
| December 18, 2025 at 9:14 am #17673691 | |
|
Kristof |
# WPML Support Ticket: Gutenberg Block Translation Issues ## Environment - WordPress Theme with custom Gutenberg blocks --- ## Issue 1: Theme's wpml-config.xml not loaded for Gutenberg blocks ### Problem The `wpml-gutenberg-config` option in `wp_options` remains empty even though a valid `wpml-config.xml` exists in the theme root directory. WPML reads other sections of the config (custom-fields, taxonomies) but ignores the `` section. ### Expected behavior WPML should parse the `` section from the theme's `wpml-config.xml` and populate the `wpml-gutenberg-config` option. ### Actual behavior The option stays empty, causing WPML to use fallback behavior (registering entire HTML blocks instead of extracting text via XPath selectors). ### Workaround implemented We manually parse `wpml-config.xml` and write the config directly to the `wpml-gutenberg-config` option via PHP: ```php --- ## Issue 2: Non-breaking space (nbsp) encoding mismatch ### Problem When WPML extracts strings from Gutenberg blocks, it adds trailing non-breaking spaces (`xC2xA0` in UTF-8). However, the actual post content may have: - Regular spaces (0x20) This causes translation lookup to fail because the hash is calculated with the nbsp but the content doesn't contain it. ### Example - WPML stores: `"Wichtig: Degus sind Nageprofis.xC2xA0"` (ends with nbsp) ### Hex evidence ``` ### Workaround implemented We generate multiple encoding variants when searching for strings to replace: ```php --- ## Issue 3: Ampersand encoding mismatch ### Problem Similar to nbsp, ampersands are handled inconsistently: - WPML stores: `"Sauberkeit & Hygiene"` (decoded) For "VISUAL" strings (containing HTML tags), WPML skips `html_entity_decode()`, but the hash is still calculated with the decoded version. ### Code reference in WPML ```php ### Workaround implemented ```php --- ## Issue 4: Emoji handling inconsistency ### Problem When posts contain emojis (e.g., `�� Important text...`), WPML may extract the string with the emoji, but the translated post content might not have it (if the translation was created before emojis were added). ### Workaround implemented ```php --- ## Summary of Workarounds We implemented a `WpmlServiceProvider` class that: 1. Manually syncs Gutenberg config from `wpml-config.xml` to `wpml-gutenberg-config` option ### Files affected - `app/Providers/WpmlServiceProvider.php` (all workarounds) --- ## Requested Fix Please ensure consistent encoding handling in WPML's Gutenberg string extraction and translation lookup: 1. **Load theme's `wpml-config.xml` gutenberg-blocks section** into `wpml-gutenberg-config` option --- ## Test Case 1. Create a custom Gutenberg block with `RichText.Content` component --- ## Related Files in This Project | File | Description | |
The topic ‘[Closed] Gutenberg Block Translation Issues’ is closed to new replies.