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.

This topic contains 19 replies, has 2 voices.

Last updated by Raja Mohammed 4 months ago.

Assigned support staff: Raja Mohammed.

Author Posts
October 5, 2019 at 1:28 pm #4700441

John-Pierre Cornelissen

I am trying to:
Translate a website from Dutch to English. Translation with ATE goes wrong for the ampersand sign in two instances:

- B & B Saenliefde in Wormer-North Holland (in the page header)
- More info & route (button lower right)

Link to a page where the issue can be seen:
hidden link

I expected to see:

- B & B Saenliefde in Wormer-North Holland (in the page header)
- More info & route (button lower right)

Instead, I got:

- B & B Saenliefde in Wormer-North Holland (in the page header)
- More info & route (button lower right)

In the ATE it looks correct, but in the end results it's wrong.

How can I fix this?

Thanks
JP

October 7, 2019 at 7:45 am #4705079

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello there,

This is not an issue related to WPML but an expected behavior from the WordPress itself, WordPress by default changes HTML characters to encoded strings. You can try the suggestion mentioned in the link to display & without being converted to & https://wordpress.stackexchange.com/a/264996

However, I would also highly recommend consulting with the theme author if they have any alternative solution.

Kind regards
Raja

October 7, 2019 at 8:14 am #4705171

John-Pierre Cornelissen

Hi, I have to disagree with that. This problem does not occur on the source page. No matter if I look in edit mode or on the published page, it show the actual & character I have entered in the content.

That character is then sent to the ATE to translate, in the ATE it looks fine but it's wrong when the ATE sends the translation back into WordPress. That looks like that somewhere in that process WPML converts the text character & into a html encoded string.

October 7, 2019 at 9:09 am #4705773

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks for the clarification, I am checking this with the team. In the meantime could you please provide temporary access to your site let me check for a few parameters. I have enabled private fields for you to securely share the details.

October 7, 2019 at 12:39 pm #4707217

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm not sure what is causing this since not all the B & B content is changed to & only a selective amount of those in heading has transformed. To isolate the issue please install DIVI to the sandbox site => hidden link

Also please complete the WPML set up the same as your site. let me know once done.

October 8, 2019 at 9:15 am #4713465

John-Pierre Cornelissen

Hi Raja,

I installed Divi and created a page with the modules that most likely will cause the issues. I started configuring WPML, but I get stuck enabling the advanced translation editor. Although I have enabled it, as soon as I go to translate a page, it opens the classic translation editor. Can you fix that so we can use the ATE?

Thanks
JP

October 8, 2019 at 11:23 am #4714633

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello JP,

I have enabled ATE for the site. Please check whether the issue can be reproduced

Kind regards
Raja

October 8, 2019 at 11:55 am #4714843

John-Pierre Cornelissen

Done

Auto translated in English, German and French.
Somehow the English page remains empty.

But the problem is reproduced on the German and French translations.

It looks like the problem only occurs with single line entry fields and not with normal text/content area's.

JP

October 9, 2019 at 4:54 am #4719469

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks for your efforts, I have escalated the issue to the second tier.

FYI, I have also noticed the issue happens only with the ATE editor and with the WPML Classic translation editor.

I will keep you posted once I have an update.

October 9, 2019 at 7:15 am #4720095

John-Pierre Cornelissen

Ok, thank you so far.

October 9, 2019 at 7:28 am #4720155

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The issue has been escalated to the compatibility team and further to the core developers. This might take some time to fix. I would require your patience in this regard. I will let you know the status once I have an update

October 9, 2019 at 8:29 am #4720711

John-Pierre Cornelissen

Is it ok to temporarily 'fix' it by editing the translated page in WordPress? Or is that going to cause other problems later on?

Thanks
JP

October 9, 2019 at 12:34 pm #4722861

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Please use the below code in your child theme functions.php, This would filter the content as a workaround and displays the & properly without changing anything in your database. The code is tested in the sandbox site, Please verify the same hidden link

add_filter( 'the_content', 'filter_the_amp_content',100 );
 
function filter_the_amp_content( $content ) {
 
          $content =  str_replace("&","&",$content);
  
    return $content;
}
October 9, 2019 at 12:54 pm #4723177

John-Pierre Cornelissen

Hi,

I added it (see screenshot) but it doesn't work.
See hidden link

wpml.jpg
October 10, 2019 at 4:44 am #4727193

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Oops! the forum is automatically converting & amp; to &, The parameter in str_replace should have & amp; please copy the code from https://pastebin.com/PfAgDrXQ

Screenshot 2019-10-10 at 10.12.50 AM.png