Home›Support›English Support›[Resolved] One string translation is not being applied unless "auto-register strings" is on
[Resolved] One string translation is not being applied unless "auto-register strings" is on
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is trying to display the Italian translation of a 'Sign Up Now' button from WooCommerce Subscriptions on their WooCommerce shop. Despite translating the strings and following the provided documentation, the translation only appears when 'auto-register strings' is enabled. The issue persists even after regenerating .mo files and checking for transients.
Solution: We have identified that a plugin called 'DF Customizations' is causing the translation issue. By disabling this plugin, the button text translates correctly on the frontend. We recommend reviewing the 'custom_load_custom_style_sheet' function within the 'DF Customizations' plugin, as it seems to be introducing elements that are not being translated. If elements loaded by this function are not translated, they should be translated accordingly to ensure the button text appears correctly in each language.
If this solution does not seem relevant to your situation, please feel free to open a new support ticket with us, and we will be glad to assist you further.
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.
Our next available supporter will start replying to tickets in about 7.08 hours from now. Thank you for your understanding.
Tell us what you are trying to do?
I have to show the Italian translation of a product in a WooCommerce shop. The string that does not translate comes from WooCommerce Subscriptions
Is there any documentation that you are following?
I have read and applied what your tech support suggested at:
Is there a similar example that we can see?
The first link above. But in my case, the solution provided did not fix the issue. The label on the "Sign Up Now" button only shows in Italian if I enable "auto-register strings".
I have regenerated the .mo files as per solution 1 and checked if there's a transient as per solution 2 (there is not).
In the String Translation screen (see screenshot) there are multiple "Sign Up Now" buttons (with different case too) and I have translated all of them.
I understand the issue you're having and will try my best to assist you in this matter.
Could you please attempt the following steps to see if they resolve the issue:
1. Navigate to "WPML > Theme and Plugins localization."
2. Check the "Automatically load the theme's .mo file using 'load_textdomain'" option.
3. In the "Enter textdomain:" field, ensure that you have included the textdomain for the WooCommerce Subscription plugin, which is "woocommerce-subscriptions."
4. Save the changes.
5. Go to "WPML > String Translation" and re-save the translation for the button.
6. Now, go to "WPML > Support > Troubleshooting."
7. Scroll down to locate the "Show custom MO Files Pre-generation dialog box" button, and click on it.
8. A popup will appear after the page loads. In the popup, you will find a button named "Generate .MO files." Click on it and wait for the process to complete.
9. Once finished, clear both the site and browser caches, and then check the frontend.
I hope the steps above will help to solve the translation issue with the Sign-up button. But, feel free to let me know if you need further assistance in this matter. I will be happy to help.
Hi There,
Thank you for trying out the suggestion.
Since the issue persists even after these steps, a closer inspection will be required to understand the root cause of the issue. 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.
You will find the needed fields below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.
IMPORTANT
-Please backup site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Hello There,
Thank you for sharing the access information. Sorry for the delay in responding due to the weekend.
I checked by applying the solutions available to solve the issue but it seems none of them working. For your information, the Subscription Button text appears correctly translated when I checked in a fresh environment.
Now, to investigate the issue further, I took a copy of your site and will be deploying that in my development environment. As soon as I have any update on this, I will let you know.
Thank you for your patience and cooperation in this matter.
Deploying the package in my local environment took some additional time due to multiple database-related errors. However, after a thorough investigation, I successfully completed the setup and identified the primary issue.
The root cause seems to be linked to a plugin on your site called "DF Customizations." Disabling this plugin resulted in the button text being correctly translated on the frontend. For a clearer picture, please refer to this screenshot: hidden link.
On examining the code of the "DF Customizations" plugin, it appears to be a custom development tailored for your site. Notably, when I commented out the `add_action` hook involving the 'custom_load_custom_style_sheet' function, the translation issue was also resolved.
This leads to the conclusion that the problem lies within the 'custom_load_custom_style_sheet' function. Since providing support for custom code is outside our standard support scope, I can offer guidance but not a direct solution. I recommend reviewing what this function is loading on the frontend. If there are elements introduced by this function that aren't translated, they should be translated accordingly. In this way, the button text will appear correctly translated in each language.
I hope you can understand. Feel free to let me know if there is anything else if you need help with. I will be happy to assist.