Home›Support›English Support›[Resolved] Strings are translated only when auto-register strings for translation is on
[Resolved] Strings are translated only when auto-register strings for translation is on
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an issue where strings are only translated when the auto-register strings for translation feature is enabled. They have followed certain documentation and provided code examples from their site.
Solution: 1. We recommend generating .mo files by navigating to WPML > Support > Troubleshooting and clicking on "Show custom MO Files Pre-generation dialog box". It's crucial to back up the database and website before proceeding.
2. If the issue persists, we suggest replacing the custom function
translateTheme()
with the gettext function
__()
for outputting the button text. For example:
<?php echo __('Buy Now', 'dt_theme'); ?>
Afterward, scan for strings in the child theme by going to WPML > Theme and plugins localization and translate them.
If these steps do not resolve the issue, we recommend contacting one of our certified partners for further assistance. You can find a list of our certified partners here: https://wpml.org/contractors/.
If this solution doesn't look relevant, please open a new support ticket in our support forum.
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.
Thank you for contacting WPML support, I'd be happy to help you with this issue.
It looks like the translation string is not generated to the .mo file correctly. Please try to go to WPML > Support > Troubleshooting > Click on "Show custom MO Files Pre-generation dialog box" and generate .mo files to see if it helps.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
I also see the string is located in the child theme, please share the code that you output the string in the frontend if it does not help.
I see you are using a custom function translateTheme() to output the button text. I would like to inform you that helping you with custom code, is out of the scope of WPML. However, I suggest you try using the gettext function __() to register the button text for translation. For example:
<?php echo __('Buy Now', 'dt_theme'); ?>
then go to WPML > Theme and plugins localization > Scan strings in the child theme and translate it.
If you are not able to accomplish this, I would recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/
I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info.
❌ IMPORTANT: Please backup your database and website before proceeding ❌
You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/
✙ I would need your permission to de-activate and re-activate Plugins and the Theme to change configurations on the site if needed. This is also a reason the backup is critical.
I've tried cloning the live production to a dev environment. I noticed that the problem only occurs on the live production. Please see the attached images.
It looks like a sort of cache, please try to clear them all (browser, plugin, hosting, Cloudflare ...) and recheck the issue. Or you can push the data from the dev site to the live site and see if it works.
If not, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. Your next reply is set to private to share the info.
This happens because the plugin "Performant Translations" is activated on your site. I deactivate it and the translation string is displayed correctly in the frontend.
Can you please confirm it works on your end?