[Resolved] Strange behaviour and translated text missing
This thread is resolved. Here is a description of the problem and solution.
Problem: The client was experiencing issues with translations missing in the Advanced Translation Editor (ATE) even though they were present on the site.
Solution: We advised the client to re-translate the sentences in ATE if they had recently made changes to the HTML code that did not alter the sentences themselves. Changes in HTML tags and attributes can be seen as a block change by ATE, which might result in the content being erased. We also requested the client to provide a before/after comparison of the HTML code changes or replicate the issue on a clean WordPress installation provided by us, to help identify the root cause of the issue.
If you're experiencing similar issues, we recommend re-translating the affected sentences in ATE. If the problem persists, please provide detailed information about the changes made or replicate the issue on a clean installation and inform us of the steps taken.
Please note that the solution provided might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.
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.
I am trying to:
Checking some of the translated pages that had been marked as complete, I noticed that the page was marked as needing attention. Our tech team did add some translated versions of error messages in the code, but the page itself had been untouched.
When looking at the page on the website, the text is all there and is fine. My concern is that when I go to the translation editor, some of the text translation is missing and I don't want to mess things up.
Other strange behaviour seems to happen. The license seemed to be disconnected for a brief time and Kinsta, the platform hosting our WordPress site logged error messages from WPML that I'm pasting here:
2024/02/01 14:32:35 [error] 47976#47976: *27336 FastCGI sent in stderr: "PHP message: PHP Warning: Attempt to read property "element_id" on null in /www/ifcsn_953/public/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/jobs/class-wpml-tm-rest-jobs-view-model.php on line 187PHP message: PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /www/ifcsn_953/public/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/jobs/class-wpml-tm-rest-job-progress.php:41
Stack trace:
#0 /www/ifcsn_953/public/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/jobs/class-wpml-tm-rest-jobs-view-model.php(116): WPML_TM_Rest_Job_Progress->get(Object(WPML_TM_Post_Job_Entity))
#1 /www/ifcsn_953/public/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/jobs/class-wpml-tm-rest-jobs-view-model.php(66): WPML_TM_Rest_Jobs_View_Model->map_job(Object(WPML_TM_Post_Job_Entity), Object(WPML_TM_Jobs_Search_Params))
#2 /www/ifcsn_953/public/wp-content/plugins/sitepress-multilingual-cms/classes/API/REST/class-wpml-tm-rest-jobs.php(215): WPML_TM_Rest_Jobs_View_Model->build(Object(WPML_TM_Jobs_Collection), 119, Object(WPML_TM_Jobs_Search_Params))
#3 /www/ifcsn_953/public/wp-includes/rest-api/class-wp-rest-server.php(1193): WPML_TM_REST_Jobs->get_jobs(Objec" while reading response header from upstream, client: 192.109.159.95, server: env-ifcsn-ifcsnstaging.kinsta.cloud, request: "GET /wp-json/wpml/tm/v1/jobs/?limit=20&offset=0&sorting%5Bid%5D=desc&pageName=tm-jobs HTTP/2.0", upstream: "hidden link:", host: "env-ifcsn-ifcsnstaging.kinsta.cloud:57858", referrer: "hidden link"
If I click on the "job" page within WordPress, it says that jobs cannot be loaded. (See screenshot)
Link to a page where the issue can be seen: hidden link
New threads created by Long Nguyen and linked to this one are listed below:
Thank you for contacting WPML support, I'd be happy to help you with this issue.
I understand you have two issues, one is the translation of some sentences is available on your site but not on Advanced Translation Editor (ATE), two is the error when visiting WPML > Translations.
We can handle one issue per ticket only so I will split the second issue into another ticket for better handling.
In this ticket, I will focus on the translation in ATE. I see those sentences have been translated before but somehow the translation memory doesn't work in this case. I'm asking our 2nd tier support about this issue and update you here when I have something to share.
Our 2nd tier support is still checking the issue. They see that two sentences are part of an HTML script code:
<script>
"use strict"
window.onload = function() {
const params = new URLSearchParams(window.location.search);
var mode = params.get("m");
if (mode=="le") {
document.getElementById("loginError").innerHTML = "Invalid username or password.<br /><br />";
} else {
document.getElementById("loginError").innerHTML = "";
}
}
function checkForm() {
var formGood = true;
var email = document.getElementById("email").value;
if (email == "") {
formGood = false;
document.getElementById("emailErr").innerHTML = "<br />Email is required";
} else {
document.getElementById("emailErr").innerHTML = "";
}
var password = document.getElementById("password").value;
if (password == "") {
formGood = false;
document.getElementById("passwordErr").innerHTML = "<br />Password is required";
} else {
document.getElementById("passwordErr").innerHTML = "";
}
if (formGood) {
document.getElementById("loginform").submit();
}
}
</script>
<span id="loginError" class="errmsg" style="margin-right:50px;"></span>
<p style="color: black; margin-right:50px;">Please log in to access IFCSN's GDPR secure portal. If you do not have an account, you can register as a requester <a href="/index.php/how-to-apply/" class="reglink">here</a>, and as a provider <a href="/index.php/request-a-payment/" class="reglink">here</a>.
</p>
<form id="loginform" method="post" action="/ifcsn-login-a.php">
<table>
<tbody style="background-color: white;">
<tr>
<td>Email <span id="emailErr" class="errmsg"></span></td><td><input type="text" id="email" name="email"></td>
</tr>
<tr>
<td>Password <span id="passwordErr" class="errmsg"></span></td><td><input type="password" id="password" name="password"></td>
</tr>
<tr>
<td> </td><td><button type="button" id="goBtn" onclick="checkForm()" class="elementor-size-lg elementor-button elementor-button-link">Submit</button><br /><br />
<a href="/index.php/ifcsn-forgot-pw/" class="reglink">Forgot Password</a>
</td>
</tr>
</tbody>
</table>
</form>
and the code is parsed in ATE to translate the sentence. Recently, have you adjusted the HTML tag and attributes or anything else, but not the sentence itself? We need to know what was changed or how to replicate the issue to find the root of the issue.
That could be the issue, our 2nd tier support also said that things coming from HTML are tricky because in many cases, they are seen as a block, so they can erase all the content inside it. If that is the case, you need to re-translate sentences in Advanced Translation Editor.
Furthermore, can you please let me know exactly what was changed in the HTML code (before/after)? If it is possible, please help me replicate the issue on a clean installation of WordPress. You can login to the admin area with this link hidden link
Kindly follow the steps below:
- Don’t restore your site there.
- Try to replicate the issue with minimal steps.
- Then let me know the steps to replicate it.
I talked with our tech team and the html code edits they made are too extensive to reproduce here.
We will replace the missing sentences. Also, the tech team will create a file outside the webpages with the Html code. The link to those pages won't change, but the code can be changed without causing these kinds of alteration that make the translation disappear.
Please translate the sentences in ATE again. If the issue occurs again, let me know exactly what was changed on your site so I can replicate the issue on my end.