Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Bobby 1 year, 11 months ago.

Assisted by: Bobby.

Author Posts
August 8, 2023 at 3:51 pm #14170919

Xavier

The pencil icons to translate strings in the String Translation plugin have suddenly disappeared (attached image)

An error appears in javascript console (attached image)

This generated attribute data-string looks incorrect (attached image):
{"string_id":"56316","string_language":"fr","string_package_id":"310","context":"gutenberg-40652","gettext_context":"","name":"010b29471a50cdbce893491a3d2bf0b8","value":"AB Apartment Barcelona<\/strong>:

2023-08-08_17-49.png
2023-08-08_17-47_1.png
2023-08-08_17-47.png
August 9, 2023 at 4:29 pm #14177481

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

There is a possibility this is being caused by a third-party plugin as I am not able to reproduce the behavior in a clean environment with just WPML.

Did you recently install any new third-party plugins?

Also, please go to Plugins->Add new->Commercial tab -> check for updates and update WPML to the latest version available.

If the latest version is not available please get it from our site here:
https://wpml.org/account/downloads/

Let me know your results, please.

August 9, 2023 at 5:19 pm #14177677

Xavier

No, there's not any possibility. I've already made tests with just WPML and String Translation plugins active and with default theme.

The problem, as mentioned, is about the content. WPML generates a data attribute "data-string" and is malformed. Here is your code:

// getString :: HTMLElement → json object
const getString = element => {
const string = JSON.parse(element.parentNode.dataset.string);
string.value = entities.decode(string.value);

return string;
};

// addStringData :: HTMLElement → object
const addStringData = element => ({el: element, string: getString(element)});

const statusElements = findAll('.languages-status')
.map(addStringData);

"data-string" attribute value for first string is : {"string_id":"56386","string_language":"ca","string_package_id":"312","context":"gutenberg-319","gettext_context":"","name":"d852e73030522509b45b201bc3b351c0","value":"<div class=\"disclaimer\">D'acord amb el que disposa el Reglament General de Protecci\u00f3 de Dades (REGLAGMENTO (UE) 2016\/679 posa al seu coneixement la seg\u00fcent informaci\u00f3 sobre el tractament de dades personals.Responsables<\/strong>: Institut Catal\u00e0 de la Retina, S.L., Institut Catal\u00e0 de Cirurgia refractiva, S.L. (en endavant ICR) Contacte Delegat de Protecci\u00f3 de Dades<\/strong>: C\/Pau Alcover n\u00ba 67 08017 Barcelona Finalitat<\/strong>: La finalitat del tractament \u00e9s proporcionar-li la informaci\u00f3 que ens sol\u00b7licita. Legitimaci\u00f3<\/strong>: La base legal per al present tractament \u00e9s la sol\u00b7licitud realitzada per vost\u00e8. Destinataris<\/strong>: Els destinataris de la informaci\u00f3 s\u00f3n els departaments i delegacions en els quals s'organitza ICR, en part o en la seva totalitat. No es comunicaran a tercers. Drets<\/strong>: En qualsevol moment, vost\u00e8 pot exercir els seus drets d'acc\u00e9s, rectificaci\u00f3, supressi\u00f3, oposici\u00f3, limitaci\u00f3 del tractament i\/o portabilitat de les dades mitjan\u00e7ant escrit dirigit al Delegat de Protecci\u00f3 de Dades DPD a la direcci\u00f3 establerta facilitada a contacte. Tamb\u00e9 pot revocar els consentiments a altres tractaments. Tamb\u00e9 pot sol\u00b7licitar m\u00e9s informaci\u00f3 al DPD sobre els tractaments realitzats. En cas que consideri que s'han vulnerat els seus drets vost\u00e8 pot presentar una reclamaci\u00f3 davant l'Autoritat de Control en mat\u00e8ria de Protecci\u00f3 de Dades competent. Conservaci\u00f3<\/strong>: Les dades recollides seran conservades durant els temps necessari per a la gesti\u00f3 sol\u00b7licitada, amb un m\u00e0xim de 30 dies.<\/div>","status":"0","translation_priority":"optional"}

(view attachement image)

Your code tries to JSON.parse this string and it fails. You can reproduce this error in console (view attachment)

Please, our development is stopped because this bug... What can we do to fix it?

2023-08-09_19-17.png
2023-08-09_19-05.png
August 10, 2023 at 12:33 am #14178833

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for providing this additional information, I understand this issue is urgent.

I can see you are using an older version of WPML, please update to the latest versions and let me know if the issue persists.

Please go to Plugins ->Add new->Commercial tab and click on "check for updates" and update WPML and it's add-ons including String Translation to the elatest versions available.

At the moment 4.6.5 and 3.2.7

https://wpml.org/account/downloads/

To save time, if the issue persists I have also enabled a private field reply where you can share access to your environment for us to further debug, but please do try with the latest versions of the plugin first.

August 14, 2023 at 7:53 am #14195347

Xavier

I've updated both plugins. The problem still persists

August 14, 2023 at 6:47 pm #14199575

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

August 17, 2023 at 9:15 am #14244235

Xavier

I've found the problem.. It's in file wpml-string-translation/classes/string-translation-ui/class-wpml-string-translation-table.php line #132:
[code]
<tr valign="top" data-string="<?php echo esc_attr( htmlentities( (string) json_encode( $icl_string ), ENT_QUOTES ) ); ?>">
[/code]

If I remove esc_attr everything works as expected... this esc_attr modifies ouput:
""" => "&quot"

and produces a json error when JS tries to read it

August 17, 2023 at 8:36 pm #14248761

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for updating us!

I am still not able to reproduce this behavior in a new environment.

Based on the string affected, I assume it has to do with the way the content of that specific page has been created. May I ask you to access the following sandbox and let me know your results -- are you able to reproduce this behavior?

hidden link

The topic ‘[Closed] The pencil icon does not appear in the translation strings.’ is closed to new replies.