This thread is resolved. Here is a description of the problem and solution.
Problem: Read More strings are not translated anymore
Solution: It is not a WPML issue. This problem is happening because of a wrong code in the functions.php file of their theme. Correcting it has fixed the issue.
Relevant Documentation: https://wpml.org/forums/topic/strings-are-not-translated-anymore/#post-13528831
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: Not WPML issue
This topic contains 13 replies, has 3 voices.
Last updated by nascoL 1 year, 9 months ago.
Assisted by: Bigul.
Author | Posts |
---|---|
April 4, 2023 at 2:07 pm #13401021 | |
nascoL |
I am trying to: see translated strings in our templates. They used to work, they are visible at String Translation, but the translations are not appearing. Link to a page where the issue can be seen: hidden link. You see "Read more", but this needs to be Dutch "Lees meer" |
April 4, 2023 at 4:22 pm #13402499 | |
Laura Supporter
Languages: English (English ) Italian (Italiano ) Timezone: Europe/Rome (GMT+01:00) |
Hi, thanks for contacting us. Please try to If it doesn't work, please provide us with more information about what's creating the strings and where we can see them |
April 11, 2023 at 2:01 pm #13446813 | |
nascoL |
HI, Thanks for reaching out. I tried the above, but to no avail. It can be seen on the following page for example: hidden link This string is used in multiple templates (I have attached a screenshot of the syntax used). Also I provided a screenshot of the WPML string translation side. Hopefully you can help debug this issue with me. |
April 11, 2023 at 4:03 pm #13448043 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hello, Thank you for the updates. Hope these templates are part of your theme. Just to make sure, have you tried the following steps? 1) Visit *WPML>>Theme and plugins localization* page Please visit WPML>>String Translation after a site backup and enable the *Look for strings while pages are rendered* option of *Auto register strings for translation* section(on the bottom of the screen). Then visit the frontend pages and check whether the issue is existing or not. This option will be disabled in a couple of hours automatically. But will help us to track the issue in similar cases. -- Bigul |
April 12, 2023 at 10:01 am #13454197 | |
nascoL |
Hi Bigul, I have tried the suggestions, but they seem not to work. See attached screenshot for a possible clue. The file that is shown at the View column of String Translation of the "Read more" translation, is only one reference file, but the string is present in at least 5 files. Thanks in advance, Dennis |
April 12, 2023 at 4:08 pm #13457633 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Dennis, Thank you for the updates. Please fill in the private details fields(including the FTP details) after a full site backup{mandatroy}. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information-sharing policies. hidden link Also, share with me the URL of the pages where this link is showing. -- Bigul |
April 19, 2023 at 2:30 pm #13505473 | |
nascoL |
PS. I won't give you all pages, because that are a lot, but a few to check: Hope this will suffice! |
April 19, 2023 at 4:08 pm #13506325 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Dennis, Thank you for the login information and details. This requires more testing. So please allow me to make a duplicator copy of your site using the Duplicator plugin(https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server. So we can troubleshoot the issue without affecting your live site. -- Bigul |
April 20, 2023 at 9:19 am #13510077 | |
nascoL |
Yes, please be my guest and try debugging it locally. Since yesterday there also has been a bug with translation of the websites (I opened a separate ticket for this), maybe related to the recent WPMl updates. |
April 20, 2023 at 4:29 pm #13513257 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Dennis, Thank you for the permission. I made a copy of the site and tested it locally. The issue is existing after the intial checks. So consulting with our team for the expert opinion. We will get back to you as early as possible. Please wait. -- Bigul |
April 21, 2023 at 9:11 am #13516515 | |
nascoL |
Thanks for your reply. I wil await your answer. |
April 21, 2023 at 5:12 pm #13519333 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Dennis, Thank you. The ticket is escalated to our second-tier team for further debugging. Because the bug is existing after the primary debugging procedures. We will get back to you as early as possible. Please wait. -- Bigul |
April 24, 2023 at 4:34 pm #13528831 | |
Bigul Supporter
Languages: English (English ) Timezone: Europe/Vienna (GMT+01:00) |
Hi Dennis, Our second-tier team has found the reason for this bug. It is because of the following code in the functions.php file of your theme. function custom_text_replace($translated_text, $untranslated_text, $domain) { switch ($untranslated_text) { case 'Get a Quote': $translated_text = __('Learn More', $domain); break; case 'Leave a Comment': $translated_text = __('Share Your Thoughts', $domain); break; case 'Search': $translated_text = __('Find', $domain); break; default: $translated_text = $untranslated_text; break; } return $translated_text; } add_filter('gettext', 'custom_text_replace', 20, 3); We are getting the expected results on the local copy after commenting on this code. Please check the attached image. This conflict happens because of the default condition. If strings don't match it will replace translated text with the original text therefore WPML translation doesn't work. default: $translated_text = $untranslated_text; break; So please correct this code and make sure you are getting the expected results or not. -- Bigul |