This thread is resolved. Here is a description of the problem and solution.
Problem:
You are working on a site under development and have added a plugin in the widgets. While you can translate some strings using WPML, others remain untranslated.
Solution:
First, ensure you back up your site. Then, add the following code to your
// WPMl Workaround for compsupp-7428 function wpml_compsupp7428_register_and_translate_labels_for_wooVPF($label) { if (class_exists('Sitepress')) { $string = $label; $textdomain = ' woo_vpf_ymm'; // Replace with your actual text domain $string_name = 'Woo VFP: ' . substr($string, 0, 20); if (apply_filters('wpml_default_language', NULL) == apply_filters('wpml_current_language', NULL)) { do_action('wpml_register_single_string', $textdomain, $string_name, $string); } // Apply the translation to the string $label = apply_filters('wpml_translate_single_string', $string, $textdomain, $string_name); } return $label; } // List of filters to apply the custom function $label_filters = [ 'woo_vpf_ymm_year_label', 'woo_vpf_ymm_make_label', 'woo_vpf_ymm_model_label', 'woo_vpf_ymm_engine_label', 'woo_vpf_ymm_category_label', 'woo_vpf_ymm_keyword_label', 'widget_woo_vpf_ymm_label_year', 'widget_woo_vpf_ymm_label_make', 'widget_woo_vpf_ymm_label_model', 'widget_woo_vpf_ymm_label_engine', 'widget_woo_vpf_ymm_label_category', 'widget_woo_vpf_ymm_label_keyword', 'widget_woo_vpf_ymm_label_search', 'widget_woo_vpf_ymm_label_reset_search' ]; // Apply the custom function to each filter foreach ($label_filters as $filter) { add_filter($filter, 'wpml_compsupp7428_register_and_translate_labels_for_wooVPF'); }
After adding the code, follow these steps:
- Go to the page with the strings in the original language to register it.
- Navigate to WPML > String Translator and locate the strings.
- Change the language of the strings from English to French.
- Translate the strings to English.
If this solution does not resolve your issue or seems outdated, we 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 further assistance is needed, please open a new support ticket 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.
This topic contains 4 replies, has 2 voices.
Last updated by 7 months, 1 week ago.
Assisted by: Ilyes.