[Resolved] Translated Hardcoded Strings are not appearing
This thread is resolved. Here is a description of the problem and solution.
Problem: You are experiencing an issue where a hardcoded string 'Built for the New Reality' on your homepage is not displaying its French Canadian translation on the live site, despite working on the staging site. You've tried saving the page, syncing theme translations, updating the translated string in String Translation, and clearing the page cache. Solution: We noticed that WPML could not write to the
/wp-content/languages/wpml
folder, which prevents it from generating the .mo files necessary for displaying translations. To resolve this, please ensure that WPML has the necessary permissions to write to this folder. You can do this by following these steps: 1. Visit the WPML documentation on .mo file generation. 2. Navigate to WPML → Theme and Plugins Localization. 3. Generate the .mo files.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, 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 needed, please do not hesitate to open a new support ticket for further assistance at WPML 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.
Background of the issue:
I have a string on the homepage that is hardcoded in the theme, 'Built for the New Reality'. We have the French Canadian translation yet it is not showing it on the site when viewing in French Canadian. I have tried saving the page, sync theme translations, changing the translated string in String Translation, and cleared page cache. I am seeing the translated string on our staging working fine, just for some reason not on our live site.
Symptoms:
Translated hardcoded strings are not appearing on the live site in French Canadian.
Questions:
Why is the translated string not appearing on the live site?
What steps can I take to ensure the translation appears correctly?
Can you show me where and how it was hardcoded in the screenshots? I want to ensure that I fully understand this so that I can provide the best possible solution. You can also share the code here where it is hardcoded.
I've attached the screenshot of the template and the snippet below:
<div class="homepage-feature">
<p class="home-intro"><?php the_field('header_text'); ?></p>
<p class="banner-values"><?php _e('Built for the New Reality', 'html5blank'); ?></p>
<?php $button = get_field('button') ?> ">
</div>
I also sent a screenshot of the String Translation dashboard and it shows that it recognizes the "Built for the New Reality" string and where it should be appearing.
I need to request temporary access (wp-admin and FTP) to your site—preferably to a test site where the problem has been replicated if possible—in order to be of better help. When you log in to leave your next reply, you will find the needed fields below the comment area. The information you will enter is private, meaning only you and I can see and access it.
I noticed a message in the screenshot indicating that WPML cannot write to the /wp-content/languages/wpml folder, which prevents it from generating the .mo files. This could be one reason why the translation isn't working.
Could you please follow the link below? Then, go to WPML → Theme and Plugins Localization and generate the .mo files.
Ohh okay thank you. I'll be out this coming Monday but we'll go ahead and update permissions to allow the folder to be writeable. I should respond Wednesday morning and let you know if this works. Thank you!
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.