[Resolved] String from theme options doesn´t appear translated
This thread is resolved. Here is a description of the problem and solution.
Problem: The client reported an issue where taxonomy terms such as 'Year' were not translating correctly on their vehicle listing page, despite having translations available. The default site language had been switched from English to Dutch, which seemed to affect the translation functionality. Solution: We identified that the issue was related to how the theme handled translations within specific PHP templates. To resolve this, we provided a code snippet to modify the theme's PHP file to ensure proper translation registration and application using WPML's hooks:
<?php<br />// WPML Workaround for compsupp-7432<br />if (class_exists('Sitepress')) {<br /> $textdomain = 'motors';<br /> $string_name = 'Motors - WPML String: '.substr($single_name, 0, 20);<br /><br /> if (apply_filters('wpml_default_language', NULL) == apply_filters('wpml_current_language', NULL)) {<br /> do_action('wpml_register_single_string', $textdomain, $string_name, $single_name);<br /> }<br /> // Apply the translation to the string<br /> $single_name = apply_filters('wpml_translate_single_string', $single_name, $textdomain, $string_name);<br />}<br /></code><br /><td class="t-label"> <?php echo esc_html($single_name); ?></td><br />After applying this change, the client was instructed to visit the page in the original language to register the string and then translate it via WPML > String Translator under the 'motors' textdomain.<br /><br />If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend opening a new support ticket. Additionally, please check related known issues at <a href="https://wpml.org/known-issues/">https://wpml.org/known-issues/</a>, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, you can also visit our support forum at <a href="https://wpml.org/forums/forum/english-support/">https://wpml.org/forums/forum/english-support/</a>.</td>
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.
Your colleague did install a plugin to create a copy a while ago. Is this something you can do? Makes it easier to have the same setup.
One thing to note is that the default language in the past was "English", and this was changed to Dutch. We'd need to keep it in Dutch, as our main customers are Dutch, but is there a way to set the default to English but simply redirect to Dutch if the site opens?
Hi, I've installed the theme & plugins that come with it. There is an issue with importing demo data which gives me a 504 error but it seems enough data is imported.
Menu looks a bit weird but that's ok.
What I've done is gone to "Inventory" and tested with the "Tesla Roadster 2021" listing. I've made the necessary actions in WPML so that taxonomies are being translated and I've also translated that particular listing (just copied content) to Dutch (Nederlands).
Only the taxonomy of "Years" I have created the translations for, but also for this car it's not showing the translated content on the listing page of that vehicle. It keeps showing "Year" instead of "Jaar".
Thought this would work right away because it had worked in the past on my live version and thought it only went broken after setting the default language to Dutch afterwards. For now I've left the default language set to English so I would expect it to work.
You can go to the "Inventory" tab and then open the first listing "Tesla Roadster" for example. On the right you'll see "Year" which is the default English word for it. If you then switch to the Dutch (Nederlands) version of that page, it should translate "Year" to "Jaar" but it keeps it displayed as "Year".
In the strings, taxonomy etc everything for "Year" have been translated.
Please let me know if you need help applying the solution. For that I will need FTP access or permission to install plugin File Manager.
Manage Cookie Consent
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.