Dear support,
how do I translate the placeholder of the search widget, in the filters?
<input type="search" id="woocommerce-product-search-field-0" class="search-field" placeholder="Search products…" value="" name="s">
Tried searching for placeholder in every file in theme and plugins folder, no results…tried intercepting the field in the DOM and with CSS, no joy……but that placeholder stays there, no matter what….
I solved this problem using this code in functions.php of my child theme.
add_filter('gettext', 'translate_strings');
add_filter('ngettext', 'translate_strings');
function translate_strings($translated) {
$translated = str_ireplace('Search products…', 'MYTRANSLATION', $translated);
return $translated;
}
The key here was …
, I rarely see this and my replacement code did not work for that very reason!