This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Tagged: Compatibility, Custom Work
This topic contains 13 replies, has 2 voices.
Last updated by maS-36 1 year, 11 months ago.
Assisted by: Long Nguyen.
Author | Posts |
---|---|
May 10, 2023 at 11:53 pm #13626687 | |
maS-36 |
Hi, WPML is removing/converting URI encoded HTML in vc_raw_html. In the base page the vc_raw_html is: but in the translated pages it ends up as: I need it to preserve the URI encoding for the cloudflare API to work correctly. |
May 12, 2023 at 7:52 am #13634897 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi Manuel, Thank you for contacting WPML support, I'd be happy to help you with this issue. The videos that you share are not available so I don't see the issue on your site. But I suggest you can follow the documentation below to fix the encoding issue Look forward to your reply. |
May 12, 2023 at 9:46 am #13635845 | |
maS-36 |
Hi Long, The urls are examples, please look at the diference between them after "thumbnail.jpg?". The base one has URI encoding, the translated one loses it and it creates problems with Cloudflare Stream API. We are not converting it in the translation as you can see in the attached screenshot. I created a page to ilustrate this: I already did the suggested changes in that documentation. |
May 12, 2023 at 10:53 am #13636441 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Thank you for your feedback. I see that issue on my local site with the element Raw HTML but not with the element Text Block or link in the text block. I'm asking my 2nd tier support about this issue and update you here when I have something to share. Thanks. |
May 17, 2023 at 3:21 am #13660163 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I got some information from our 2nd tier support, please check this below: ❌ IMPORTANT: Please backup your database and website before proceeding ❌ 1. Add the following code to WPML > Setting > Custom XML Configuration: <wpml-config> <shortcodes> <shortcode> <tag raw-html="1">vc_raw_html</tag> </shortcode> </shortcodes> </wpml-config> 2. Make a small change on the original page and save. 3. Translate the page. The content will be encoded on ATE/CTE but it's displayed correctly on the frontend. Let me know how it goes. |
May 17, 2023 at 7:55 am #13661651 | |
maS-36 |
Unfortunally, when I put that shortcode all the following blocks of any type no longer appear in the translation editor to be translatable. |
May 17, 2023 at 8:22 am #13662051 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Thank you for your feedback. I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated. Your next reply is set to private to share the info. ❌ IMPORTANT: Please backup your database and website before proceeding ❌ You can also check this issue on the sandbox site where I replicate the issue and apply the workaround to fix it. Look forward to your reply. |
May 18, 2023 at 2:16 am #13668727 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Thank you for your feedback. I see you are assigning the URI to an attribute of an HTML tag on your site. Then it will not be available in Advanced Translation Editor (ATE) if you use the custom XML configuration code above. It will be copied to the translation post. Is that expected when using ATE? If you use the Classic Editor (CTE), you can translate the encoded there. Please check this screenshot hidden link Look forward to your reply. |
May 18, 2023 at 3:34 pm #13673305 | |
maS-36 |
What is expected is that we are able to honor the URI encoded HTML in ATE but somehow WPML is converting it and creating problems. If we use the CTE and the XML we are not able to change specific parts of the URI that are needed to localize the videos to different languages. Also our translators are used to the ATE. |
May 19, 2023 at 1:29 am #13675523 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Thank you for your feedback. I understand the issue, you also want to adjust a part of the HTML code in a different language in the ATE. I'm asking our 2nd tier support and update you here when I have something to share. Thanks. |
May 22, 2023 at 4:09 am #13686035 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I got some information from our 2nd tier support, please check this below. It's how the "vc_raw_html" element from WP Bakery works. There are also some encoding/decoding snippets on the WPBakery side that are important to make it work. That's why you see the encoded value on CTE (this is how the field is stored in the database). There isn't an easy way to fix this issue, please try to use the workaround below to create a custom shortcode to display the video and use a custom XML configuration code to register the shortcode attribute for translation. ❌ IMPORTANT: Please backup your database and website before proceeding ❌ 1. Add the following code to the functions.php file: // WPML Workaround for compsupp-6783 function wpml_compsupp6783_video_container_shortcode($atts = []) { // Normalize attribute keys, lowercase $atts = array_change_key_case((array)$atts, CASE_LOWER); // Start output ob_start(); // Start box echo '<div class="videoContainerEOW" style="position: relative; padding-top: 56.25%;"><iframe src="' . esc_url($atts['src']) . '" style="border: none; position: absolute; top: 0; left: 0; height: 100%; width: 100%; clip-path: inset(0% 0% 0% 0% round 10px);" allow="accelerometer; gyroscope; autoplay; encrypted-media;" allowfullscreen="true"></iframe></div>'; // Return output return ob_get_clean(); } add_shortcode('custom_video_container', 'wpml_compsupp6783_video_container_shortcode'); 2. Add the following code to WPML > Settings > XML Configuration: <wpml-config> <shortcodes> <shortcode> <tag>custom_video_container</tag> <attributes> <attribute>src</attribute> </attributes> </shortcode> </shortcodes> </wpml-config> 3. Add the shortcode below to the "Text Block" element of WPBakery > Save changes and Update the translation. You can translate the URI in the ATE. [custom_video_container src="<em><u>hidden link</u></em>"] Note: I would like to inform you that helping you with custom code, is out of the scope of WPML, but we can suggest you an alternative way to solve the issue. Look forward to your reply. |
May 29, 2023 at 1:05 pm #13732521 | |
maS-36 |
Thank you Long and WPML, it works, this support flow recovered our trust in WPML. |
May 30, 2023 at 1:16 am #13735633 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, You may consider this thread resolved and feel free to create new tickets if you have more questions. Thanks. |