Filter option language
-
I wanted to translate the following to French. Where i can edit this?
Filter by Preacher
Filter by Series
Filter by Topic
Filter by Book
-
Hi there,
You can translate those strings by adding the following code at the end of your (child) theme’s
functions.php:add_filter( 'gettext', 'change_sermon_filtering_labels', 20, 3 ); /** * Change filtering labels. * * @param string $translated_text Translated text. * @param string $text Text to translate. * @param string $domain Text domain. * * @return string Translated string. */ function change_sermon_filtering_labels( $translated_text, $text, $domain ) { if ( 'sermon-manager-for-wordpress' !== $domain ) { return $translated_text; } switch ( $text ) { case 'Filter by Series': $translated_text = ''; // Translated string here, between quotes. break; case 'Filter by Topic': $translated_text = ''; // Translated string here, between quotes. break; case 'Filter by Book': $translated_text = ''; // Translated string here, between quotes. break; case 'Filter by Service Type': $translated_text = ''; // Translated string here, between quotes. break; } return $translated_text; }Thank you for your patience.
Filter by Preacher not changing. I added like below. but its not translating
case ‘Filter by Preacher’:
$translated_text = ‘Filtrer par prédicateur’; // Translated string here, between quotes.
break;Hi, my apologies, I have made a small mistake.
Please replace that section with:
case 'Filter by %s': $translated_text = ‘Filtrer par %s’; // Translated string here, between quotes. break;And then please put “prédicateur” in Sermon Manager Settings -> “Custom label for “Preacher”” setting.
I’m working on changing the archive page filters to Chinese… I have used the above code with the Chinese in the quotation marks… but nothing is changing. any reason why this is not working? I was able to change the speaker drop down by changing it in the setting, but i have copied the above code with the chinese filter names in it to my child theme function.php but nothing seems to be changing.
http://www.zhenzhujinxin.com/?post_type=wpfc_sermon
-
This reply was modified 7 years, 6 months ago by
neal514.
Hi @neal514,
Here is the updated code. Preacher label can only be changed via settings.
add_filter( 'gettext', 'change_sermon_filtering_labels', 20, 3 ); /** * Change filtering labels. * * @param string $translated_text Translated text. * @param string $text Text to translate. * @param string $domain Text domain. * * @return string Translated string. */ function change_sermon_filtering_labels( $translated_text, $text, $domain ) { if ( 'sermon-manager-for-wordpress' !== $domain ) { return $translated_text; } switch ( $text ) { case 'Series': $translated_text = ''; // Translated string here, between quotes. break; case 'Topic': $translated_text = ''; // Translated string here, between quotes. break; case 'Book': $translated_text = ''; // Translated string here, between quotes. break; case 'Service Type': $translated_text = ''; // Translated string here, between quotes. break; } return $translated_text; } -
This reply was modified 7 years, 6 months ago by
The topic ‘Filter option language’ is closed to new replies.