Skip Navigation

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: 

This topic contains 12 replies, has 2 voices.

Last updated by John-Pierre Cornelissen 5 months, 4 weeks ago.

Assisted by: Nigel.

Author Posts
May 22, 2024 at 12:39 pm #15658139

John-Pierre Cornelissen

Background of the issue:
I am using the WPML plugin to translate the contents of a Divi Code module on my WordPress site. The module contains specific code for 'bookzo-search' and 'bookzo-home' components. The issue can be seen at hidden link.

Symptoms:
When translating the code, WPML changes single quotes to double quotes, which alters the functionality of the code, causing it not to work as intended.

Questions:
1) How can I fix the issue where WPML translates single quotes into double quotes in the Divi Code module?
2) Why does WPML translate single quotes into double quotes?

Here it is again:

NL
<bookzo-search apikey='XXXXXXXXX' config='{"search":{"showPersons":false}}'></bookzo-search>
<bookzo-home apikey='XXXXXXXXX' config='{"results":{"layout":"rows","resultsPerPage":4,"showIcons":false,"showPricesPerNight":false,"defaultSortType":"name","clickableCards":true},"object":{"showPersons":false,"showPricesPerNight":false}}'></bookzo-home>

EN	
<bookzo-search apikey="XXXXXXXXX" config="{"search":{"showPersons":false}}"></bookzo-search>
<bookzo-home apikey="XXXXXXXXX" config="{"results":{"layout":"rows","resultsPerPage":4,"showIcons":false,"showPricesPerNight":false,"defaultSortType":"name","clickableCards":true},"object":{"showPersons":false,"showPricesPerNight":false}}"></bookzo-home>

3) Also, why is my support question completely rewritten and why did it strip out the sample code that I provided?
- I don't appreciate that my questions gets rewritten.
- I don't want to 'feel free' to edit your interpretation of my question.
- I don't want having to spend extra time to edit your interpretation.
- I just want to submit the exact question I wrote in the first place.
- So please add an option here to submit the original question

May 23, 2024 at 10:34 am #15662153

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Hi there

I tested this on my own local test site and I can confirm the problem.

I've escalated this so that it can be investigated further and a solution identified.

I'll update you when there is any news.

In the meantime you will need to edit the translated posts/pages with the Divi editor itself to manually adjust the content of the Code module and fix the quotes.

Regarding your observations about changes made to the support question you raised, we are trialling for a random sample of clients a new workflow for reporting issues that uses AI with the aim of making sure that the support questions are clearly articulated and include relevant information. The objective is not to replace human support, but to speed up support. I have shared your feedback with support management. (Losing the code you entered is something we are already aware of and will fix.)

May 23, 2024 at 9:04 pm #15665252

John-Pierre Cornelissen

Thank you Nigel,

I think I have a better workaround. I found the strings in string translation and copied the source into the translations. I think better then editing the translated pages with the Divi editor.

Isn't it possible to add a custom translation rule to the xml saying that the contents of the code module should be kept as is, not be translated, or copied? Or a setting to make that field visible in the ATE?

--
As for the AI, it wasn't my concern that it would replace support. The issue is that MY question was completely rewritten in a simplified version by AI, and that it dropped the level of detail I carefully added. I don't think that is how AI should be used. It's ok to have AI ask for more details if it doesn't understand the question, but it shouldn't rewrite the question on it's own without providing an option to revert back to the original input.

Thanks
JP

May 24, 2024 at 8:07 am #15666054

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

I tried adding a custom XML configuration to overwrite the default configuration to simply ignore the code module for translation, but it didn't prevent the problem with the quotes being converted to double quotes.

So it still needs assessing by the developers.

In the meantime you'll need to adopt one of the workarounds.

May 24, 2024 at 8:26 am #15666160

John-Pierre Cornelissen

Is it also not possible to make it visible in the ATE?

May 27, 2024 at 7:31 am #15672299

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

ATE segments the content, so you can't translate the whole of it, and it means you can't impose the type of quotes you need around the sections.

May 27, 2024 at 7:41 am #15672345

John-Pierre Cornelissen

So no way to use the XML to tell the ATE to keep certain segments / content from Divi modules as is?

Is there going to be a fix?

May 27, 2024 at 7:47 am #15672354

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

No, it currently isn't possible to avoid the problem when translating the page containing this code block with ATE, hence I escalated it to the developers.

I expect that, yes, we will get a fix for it, but I can't say how long that will take. I'll update you here when it has been fixed.

In the meantime you'll need to continue you with your preferred workaround.

May 27, 2024 at 7:59 am #15672459

John-Pierre Cornelissen

Ok, thanks.

May 28, 2024 at 3:48 pm #15679600

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Actually, updating the custom XML for the Code module didn't appear to work, but I was actually just seeing the existing translations in ATE translation memory from when I had translated it before.

So, this should work.

I took the existing declaration for the Code module from the wpml-config.xml file that ships with Divi and added an attribute indicating the content should be ignored during translation.

So in WPML > Settings > Custom XML Configuration you should be able to add this:

<wpml-config>
  <shortcodes>
    <shortcode>
      <tag ignore-content="1">et_pb_code</tag>
      <attributes>
        <attribute>background_image</attribute>
        <attribute>background_video_mp4</attribute>
        <attribute>background_video_webm</attribute>
        <attribute type="link">link_option_url</attribute>
        <attribute>admin_label</attribute>
      </attributes>
    </shortcode>
  </shortcodes>
</wpml-config>
May 29, 2024 at 8:49 am #15682168

John-Pierre Cornelissen

Thanks for that. Unfortunately it still 'translates' single quotes to double quotes.

I tested with a new code module on a new page, I copied the original code but changed a few of it's parameters to be sure it doesn't pull from the translation memory. The result was wrong and when I checked the string in the string translator, I saw that the translation had double quotes where it should be single quotes.

So unfortunately, this is not the solution to keep the code 'as is'.

Besides this code that should remain exactly the same in each language, there are situation where the code in a translation requires a minor change. Some widgets that pull content form an external system have a language parameter like lang=nl-NL. On the translated pages, that needs to be changed to e.g. lang=en-GB.

Now, I understand this is not a major issue as there is a workaround with the string translations, but it would be so much more user friendly if the contents of the code module could show up in the ATE.

A suggestion would be something that already partially exists. In the attachment you see external url's that are not translated and kept as is. They are not shown in the ATE unless you specifically search for them. I think that should also be done with the *entire* contents of code modules.
- Don't translate the contents of the code module.
- Don't show it in the ATE unless you search for it.
- When you search for it, show the full content without splitting it into translatable segments, so keep it as is just like in string translation.

That way, all work can be done in the ATE and you don't need to switch to string translations.

stringtranslation.jpg
code.jpg
May 29, 2024 at 11:51 am #15683337

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Based on my conversations with the developers around this issue, I don't think I can honestly offer any alternative to using String Translation for this particular scenario.

Assuming I was able to get it working for you, using ignore-content to have the translation editor ignore the Code module isn't an option if sometimes it would be necessary to translate the content, such as when it includes language parameters.

ATE cannot help but break the code content if the elements mix single quotes with double quotes; I've been told there are technical reasons for this and ATE will always convert single quotes to double quotes in such a scenario.

Which leaves the segmentation of the content into components that you can find within the ATE editor for translation, but which is done in such a way that you cannot enforce the use of quotes in the way that you need.

There is no way to register a shortcode via custom XML that specifies the segmenter should not be applied, that option does not exist.

Given that this is a fairly niche scenario for which the workaround of using String Translation is readily available, I cannot see resources being allocated to work on introducing such an option.

I've been in discussion with the second tier support and the developers directly, so they are aware, and if this is something that comes up again enough then that could change.

I'm sorry I don't have a better resolution for you.

May 29, 2024 at 12:26 pm #15683713

John-Pierre Cornelissen

Ok fair enough.

I thought it would be pretty easy to do, to bring the string from string translation over to the ATE, because the string translation also keeps the entire code as is. And if the ATE doesn't do anything with it (such as with the url from my previous screenshot), you could manually copy it the source over to the target.

Anyway, I now know it's the best and easiest to translate these codes with the string translator.

Might be something to consider as a suggested solution. Before I submitted this issue I found a few other tickets about translating the Divi code module, but none of them applied to this situation.

Thanks for your help.
JP

May 29, 2024 at 12:27 pm #15683716

John-Pierre Cornelissen

Ok fair enough.

I thought it would be pretty easy to do, to bring the string from string translation over to the ATE, because the string translation also keeps the entire code as is. And if the ATE doesn't do anything with it (such as with the url from my previous screenshot), you could manually copy it the source over to the target.

Anyway, I now know it's the best and easiest to translate these codes with the string translator.

Might be something to consider as a suggested solution. Before I submitted this issue I found a few other tickets about translating the Divi code module, but none of them applied to this situation.

Thanks for your help.
JP