facetwp_i18n
Overview
This filter allows you to translate the handful of *dynamic* strings that are otherwise not translatable using __() or _e().
For example, Dropdown facets have a “Default Label” database setting.
Parameters
- $string | string | The string to translate
Usage
add_filter( 'facetwp_i18n', function( $string ) { if ( isset( FWP()->facet->http_params['lang'] ) ) { $lang = FWP()->facet->http_params['lang']; $translations = []; $translations['es']['Any'] = 'Cualquier'; $translations['de']['Any'] = 'Jeder'; $translations['es']['Enter keywords'] = 'Introduzca las palabras clave'; $translations['de']['Enter keywords'] = 'Geben Sie Schlüsselwörter'; if ( isset( $translations[ $lang ][ $string ] ) ) { return $translations[ $lang ][ $string ]; } } return $string; });