This topic contains 0 reply, has 1 voice.
Last updated by Kristof 5 months ago.
Assisted by: Paola Mendiburu.
| Author | Posts |
|---|---|
| December 18, 2025 at 10:02 am #17673893 | |
|
Kristof |
## Environment - WordPress Theme with custom Gutenberg blocks --- ## Problem Translations for custom Gutenberg blocks exist in the WPML database and are marked as **"complete"**, but they are **not applied** to the translated post content. The original (source language) text is displayed instead of the translation. --- ## Root Cause There is an **encoding mismatch** between how WPML stores extracted strings and how it searches for them when applying translations. WPML modifies the string during extraction (adding characters, decoding entities), but during translation application it searches for the modified version which doesn't exist in the actual post content. --- ## Evidence ### Hex Dump Comparison We compared the exact bytes of a string stored in WPML vs. the actual post content: ``` **WPML adds a trailing non-breaking space (`xC2xA0`) that does not exist in the original content.** ### Database Verification ```sql Translations are in the database but never applied to the post. --- ## Affected Characters | Character | In post_content | What WPML stores | --- ## Steps to Reproduce 1. Create a custom Gutenberg block using `RichText.Content` //div[@class='text'] ``` --- ## Expected Behavior WPML should apply translations that are marked as complete. The encoding used during string extraction should match the encoding used during translation lookup. --- ## Workaround We implemented a workaround that tries multiple encoding variants when applying translations: ```php This workaround should not be necessary. --- ## Requested Fix Please ensure consistent encoding handling: strings should be stored exactly as they appear in post_content, or WPML should try encoding variants during translation lookup. |
The topic ‘[Closed] Gutenberg Translations Not Applied Due to Encoding Mismatch’ is closed to new replies.