Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Translation fails only at “Sitewide Activity”

@shanebp

Moderator

Just fyi – if you only have a few labels that you want to change, you can use these functions.

https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext_with_context

It’s a lot faster than messing with .po files.
But you need to know if the label is using a context parameter.

So you can use this approach for ‘Sitewide Activity’…

function example_gettext_with_context( $translated, $text, $context, $domain ) {

  if ( 'buddypress' !== $domain )  
        return $translated; 
        
  switch ( $text ) {

        case 'Sitewide Activity':
            return 'Bongos';		
	
        default:
            return $translated;
    }

    return $translated;
}
add_filter( 'gettext_with_context', 'example_gettext_with_context', 11, 4 );
Skip to toolbar