[Resolved] How to translate the PHP code in "WPCode Lite"Plugin
This thread is resolved. Here is a description of the problem and solution.
Problem: The client needed help with translating strings in PHP code that were not properly wrapped for translation. Solution: First, we guided the client to wrap all texts in gettext calls as per our documentation. Specifically, we advised checking step number 2.
After modifying the code, we instructed the client to use the String Translation feature in WPML to translate the modified string. The steps included enabling the "Look for strings while pages are rendered" option, visiting the front end to render the string, and then searching for the string in the String Translation interface.
If this solution does not apply to your case, or if it seems outdated, 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 issues persist, 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.
Background of the issue:
I found the strings in the PHP code in the "WPCode Lite" plugin, but the strings translation can't show in the front end. I am trying to translate the PHP code in the "WPCode Lite" Plugin for my site hidden link.
Symptoms:
The translated strings in the PHP code do not appear on the front end.
Questions:
How can I make the translated strings appear on the front end?
Thanks for contacting WPML forums support. I'll be glad to help you today.
You need to wrap the test in the GetText function. After that, you can translate the string using the string translation. Kindly check this guide to know more about translating hard-coded strings.
I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP) Preferably to a test site where the problem has been replicated.
Your answer will be private, meaning only you and I can access it.
❌ Please backup your database and website ❌
✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.
✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.
Thanks for your response.
I changed the code with the new one and I tried to use string translation to translate.
However , I noticed that in the live site the domain "wpml-fix" can' t display. So I can't finish the translation . Could you help me look into this issue in the live stie?
After changing the code, please try the following steps:
1- Go to WPML-> String Translation
2- Enable the "Look for strings while pages are rendered" option
3- Visit the front end, where you can see the string
4- Go back to String Translation
5- Search for the string