Skip Navigation

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

Problem:
You are trying to add translations to strings in WPML, but encounter an error even after increasing the memory limit, clearing the WPML cache, and updating all plugins. Specifically, when you attempt to add a translation with '0', it fails unless you add a space after the '0'.
Solution:
We recommend the following steps to resolve this issue:
1. Create a full backup of your site.
2. Connect to your site via FTP.
3. Navigate to

wp-content/plugins/wpml-string-translation/classes/string-translation-ui/ajax/SaveTranslation.php

and locate the method

\WPML\ST\Main\Ajax\SaveTranslation::run

.
4. Modify the line from:

if ( $id && $translation && $lang ) {

to:

if ( $id && isset($translation) && $lang ) {

5. Save the changes and verify if the issue is resolved.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum for further assistance.

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

Last updated by Carlos Rojas 3 weeks, 4 days ago.

Assisted by: Carlos Rojas.

Author Posts
November 8, 2024 at 12:53 pm #16382055

adrienP-9

Background of the issue:
I am trying to add translation to strings in WPML, but I am encountering an issue. I have increased the memory limit, cleared the WPML cache, and updated all plugins. The error can be seen here: hidden link. The issue is visible on this page: hidden link.

Symptoms:
When adding translation to strings, I see an error. Despite increasing memory limit, clearing cache, and updating plugins, the error persists.

Questions:
What else could be causing the error when updating string translations?

November 8, 2024 at 1:17 pm #16382153

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hello,
Thank you for contacting us

I suspect that the cause of this issue could be a lack of writing permission or a conflict with a third-party functionality. To obtain more information I would like to ask you to activate the debug mode following the steps described in this guide: https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/ then reproduce the issue and share any fatal error that might appear in the debug.log file located within the wp-content folder.

Looking forward to your message.
Regards,
Carlos

November 8, 2024 at 1:24 pm #16382196

adrienP-9

When we facing the issue when entering 0 only in the translation.

November 8, 2024 at 1:25 pm #16382197

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

I'm sorry I don't understand your previous message.

Could you elaborate a little more so I can have a better understanding?

November 8, 2024 at 1:31 pm #16382221

adrienP-9

When we put 0 here hidden link
It gives error and do not update. When I add 0 and space it works.

November 8, 2024 at 1:34 pm #16382253

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Thank you for your message and for sharing the screenshot.

Could you tell me why don't you add 0m (with the 'm' at the end)?

November 8, 2024 at 1:44 pm #16382294

adrienP-9

We don't need m for some languages.

November 8, 2024 at 2:40 pm #16382517

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

After consulting my colleagues about this issue, there is a workaround in the code:
- Create a full backup of the site
- Connect to your site via FTP
- Go to wp-content/plugins/wpml-string-translation/classes/string-translation-ui/ajax/SaveTranslation.php in the method \WPML\ST\Main\Ajax\SaveTranslation::run
- Change the line:

if ( $id && $translation && $lang ) {

- To:

if ( $id && isset($translation) && $lang ) {

- Save the changes
- Double-check that the issue disappeared.

Could you confirm that the issue disappeared?