Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
When attempting to translate a product using WPML, two issues occur: 1) slug translation is not available, and 2) every other attempt results in only code translation being available, not visual.
Solution:
The issue is identified in the file

plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-editor-ui-wysiwyg-field.php

. It involves a function that loads translation jobs, which interacts with another process in WPML, causing the problem. A temporary workaround involves commenting out specific lines in the mentioned file to prevent the issue. However, our developers have currently decided not to permanently fix this issue due to past complications with the wpautop function. If more reports arise, they may reconsider.

If this solution does not resolve your issue or seems outdated, please check the related known issues, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. We highly recommend opening a new support ticket for further assistance at WPML support forum.

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 26 replies, has 2 voices.

Last updated by Marcel 4 weeks ago.

Assisted by: Marcel.

Author Posts
September 27, 2024 at 3:56 pm #16230638

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

I’ve isolated the installation and can still reproduce the issue where the paragraph tag is being added. We're continuing to investigate this.

Regarding the Visual Mode issue I mentioned earlier—are you currently experiencing problems with the Visual Mode on any product that has content in the original language? I haven't been able to reproduce the issue myself. The product from your screenshot isn’t included in the staging installation.

Could you please confirm if you're still seeing the problem and let me know which product it's affecting so we can run further tests?

Best regards,
Marcel

September 27, 2024 at 5:05 pm #16230867

alinam-2

Hello,
I have the problem each time I want to translate a product
To see the issue, you have to re-translate, and re-translate, whatever the product.
Example attached
-1 is the original text in Fr for me
-2 is the first translation, it has p tags, in code. Where are they coming from?
-3 remaining on the same, I go to visual, it works.
-4 I re-open, no p tag, no visual.
If you translate and re-open to re-translate, it is different.
I have the same kind of issue on certain posts. Things appear, and disappear.
Hoping it helps
Regards

4-reopen-no-p-tags-no-visual.jpg
3-with-p-tags-visual-works.jpg
2-1st-version-of-translation-p-tags.jpg
1-original-product.jpg
September 27, 2024 at 5:07 pm #16230924

alinam-2

ps: there is some kind of logic somewhere .... the p tag is here, it's a version for WMPL. The p tag disappear, it's another version for WPML. The question is probably what is generating those p tags

September 27, 2024 at 5:19 pm #16230959

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Thank you for your response. As I mentioned earlier, the issue with the p tag has already been confirmed, so no further investigation is needed on that front for now. We are currently looking into why this tag is being added on your site and will update you once we have more information.

Regarding the Visual Mode: I’m unable to replicate the issue where the visual mode appears empty, as shown in the screenshot you provided. Please disregard the p tag for the moment and focus on whether the visual mode is still empty on your end. If so, could you let me know which browser you are using? We've received a report of the same issue occurring in Firefox today; however, I wasn't able to reproduce it on your site using Firefox or Chrome either.

Best regards,
Marcel

September 27, 2024 at 6:59 pm #16231151

alinam-2

Marcel,
OK, I say it's linked with p tag, you don't care, fine, I am not a tech.
Context is that all plugins are deactivated but woo and wmpl
Let's take this page:
hidden link
several products are written as not translated with those kinds of arrows. Though they were.
=> can you explain why, when you open say 20 translations (right click, open in new tab is what Id do), visual translator is absent?

September 30, 2024 at 6:39 pm #16237452

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

I feel it’s unfair to say "you don't care." I'm sincerely trying to help and have been requesting specific details to better understand/reproduce the issue and work towards a solution.

The reason I’ve been asking for more information is that I haven’t been able to replicate the issue on my end, and from what I can see, it doesn’t seem related to the <p> tag. I’m not disregarding your input—I'm just trying to identify the root cause of why the visual mode appears empty for you.

On my end, I can open hidden link">this product 20 times, and the Visual Mode consistently shows content, even after switching between tabs.

To better investigate this, I need the exact steps you're taking when the visual mode appears empty, and it would be helpful to know which browser you’re using. Are you using Firefox?

Since you speak French, please see https://wpml.org/fr/forums/topic/champs-a-traduire-restent-vide-en-mode-visuel/. It could be related to a specific environment, such as Firefox. However, I haven't been able to reproduce the issue in Firefox, and neither has my colleague who is also working on this case. Additionally, there are no <p> tags involved, which strengthens my suspicion that it's 2 different things.

Best regards,
Marcel

October 1, 2024 at 4:36 am #16238215

alinam-2

Hello,
Sorry, if "care" is not the right word about what I wrote on p tags, then it's "consider" on "include".
Again, on my side, when p tag are there, visual translator works. If not, it does. SOrry, it's "logical", from my experience, that I see a link or coincidence.

Re. issue (visual not working), are you saying that you don't see it?

Again, the problem is not always. It's sometimes, roughly 1/2.

The test you did is not the one I meant. So, I reformulate;

Let's take this page:
hidden link
several products are written as not translated with those kinds of arrows. Though they were, but that's another topic.
=> can you explain why, when you SUCCESSIVELY open say 20 DIFFERENT translations (different languages x different products) via right click, open in new tab, visual translator is sometimes present, most often absent?

If you open 20 times the same translation (same translation for same product), without doing anything in-between, well, it may seem logical that same cause produce same effect.

Re. French discussion, I see no clue there, it's about WP versions.

Do we agree, because I doubt when I read you, that visual translation is sometimes empty?

Waiting for your feedbacks

Regards

October 1, 2024 at 8:26 am #16238967

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

Re. issue (visual not working), are you saying that you don't see it?

Yes.

Let's take this page:
hidden link
several products are written as not translated with those kinds of arrows. Though they were, but that's another topic.

Could you clarify what you mean by "those kinds of arrows"? Are you referring to the "hidden link">pencil" icon that indicates the translation status? If the pencil icon is showing, it means the translation is complete. If you believe there's an issue, please provide more details or screenshots showing the problem, so I can better understand and verify the difference in what you're seeing.

Regarding this:

Can you explain why, when you SUCCESSIVELY open, say, 20 DIFFERENT translations (different languages x different products) via right-click and open in a new tab, the visual translator is sometimes present, but most often absent?

I don't see that. I need specific product examples. Most products I've checked are configured to open with the WordPress editor, not the WPML editor:

1) Please provide exact links where I can reproduce the issue,
2) If possible, please record a screen video of your steps. This will allow me to replicate the behavior on the same products and also see the browser details I've requested twice. From there, we can continue testing this locally.

If my testing steps are incorrect, please show me the exact method you used to verify it. Otherwise, we going in circles and won't be able to provide a solution if the issue isn't clearly replicable.

Best regards,
Marcel

October 1, 2024 at 9:32 am #16239207
alinam-2

Hi Marcel,
Sorry, I was not precise enough.
So, go to this page:
hidden link
Take the 6 first products there. I just changed their original version (French text).
If I open
The first one has gearwheels in translations columns, because I opened them without translation. When I opened it for this time, no visual. If you open the 2 transaltions in other tabs, you should see visual translator, this what I have as of now.
The 5 following show what I call arrovs in translation columns. They are to be re-translated.If you open them in other columns, they should have no visuel.
If you want to reproduce, change the original text, I don't care, save. And try to re-translate
Hoping it's clearer and remaining at your disposal
Regards

New threads created by Marcel and linked to this one are listed below:

https://wpml.org/forums/topic/visual-tab-in-classic-translation-editor-sometimes-not-working/

October 1, 2024 at 5:02 pm #16242232

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi again,

After further testing, I was able to identify the root cause of the added <p> tags. I started by testing with new products and sample content in your staging environment, where the issue didn’t occur. Then, I copied HTML code from an existing product (the one I mentioned earlier) and removed elements one by one until the result changed.

I can confirm that the

<p>

tags are only added when line breaks are made inside TEXT mode.

Here’s how to reproduce the issue:

1) Create a new product.
2) Switch to TEXT mode.
3) Add the following:

test test2
test3 test4

4) It will change to

<p>test test2<br />
test3 test4</p>

I have already reproduced this issue in an isolated Sandbox environment, which you can view here: hidden link. This issue has been reported to our developers, and we’re working on a solution to prevent these tags from being added.

Regarding the visual editor issue, I’ve created a separate case to handle it more efficiently.

Best regards,
Marcel

October 3, 2024 at 7:17 am #16248146

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

The issue occurs in the file

plugins/woocommerce-multilingual/inc/translation-editor/class-wcml-editor-ui-wysiwyg-field.php

. The problem happens in a specific file used by the WooCommerce Multilingual plugin. It starts with a function that loads translation jobs into the editor. This function is connected to another process in the WPML plugin, which is where the issue comes up.

We have escalated this to our developers, but we cannot guarantee a fix, as the problem only occurs in text mode, which is less commonly used compared to Visual mode. The line in question calls the WordPress core function wpautop, which converts double line breaks into paragraph tags.

As a temporary workaround, you can comment out the following lines:

<?php

class WCML_Editor_UI_WYSIWYG_Field extends WPML_Editor_UI_WYSIWYG_Field {

	public function __construct( $id, $title, $data, $include_copy_button, $requires_complete = false ) {

		// $data[ $id ]['original'] = strpos( $data[ $id ]['original'], "\n" ) !== false ?
		// 	wpautop( $data[ $id ]['original'] ) : $data[ $id ]['original'];

		parent::__construct( $id, $title, $data, $include_copy_button, $requires_complete );
	}

}

Best Regards,
Marcel

October 18, 2024 at 2:07 pm #16305192

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

Our developers have decided not to address this issue in the code for now. There have been several challenges with the wpautop function in the past, and each time we’ve tried to fix it, it ended up causing issues for other users.

Removing it isn’t an option at the moment either, as it could lead to bigger problems elsewhere. However, if we receive more reports on this in the future, they may reconsider. For now, the best way to prevent the line breaks in the Classic Editor is not doing them via TEXT mode.

Thank you for your understanding!

Best regards,
Marcel