Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Edit buddypress.pot file


  • gnfb
    Participant

    @gnfb

    So like everyone else I want to change the Title “Site-Wide Activity
    Jesus! could it be any more difficult!!

    so I followed inst from previous post
    I found the pot file in
    /wp-content/plugins/buddypress/
    downloded the editor
    found two entries with Site-wide activity
    edited both
    uploaded
    3 files
    buddypress-en.mo
    buddupres-en.po
    and original buddypress.pot
    refreshed
    empty cache
    no change
    in Site Activity page

    any help?

Viewing 5 replies - 1 through 5 (of 5 total)

  • gnfb
    Participant

    @gnfb

    this was the instructions i followed

    Customizing Labels, Messages, and URLs


    shanebp
    Moderator

    @shanebp

    Yeah, it can be frustrating to change some strings.
    I’m not sure why you’re having trouble with the .mo approach.

    For one or two changes, you can use a function in your theme/functions.php or in bp-custom.php
    Try this:

    function example_gettext_with_context( $translated, $text, $context, $domain ) {
    
         if ( 'buddypress' !== $domain )
            return $translated;
    
         switch ( $text ) {
    
            case 'Site-Wide Activity':
                return 'text you want to appear instead';
    
            default:
                return $translated;
        }
    
        return $translated;
    }
    add_filter( 'gettext_with_context', 'example_gettext_with_context', 11, 4 );

    gnfb
    Participant

    @gnfb

    thanks for the reply

    so the lines that say

    case ‘Site-Wide Activity’:
    return ‘Using gettext_with_context filter’;

    i could change to

    case ‘Whats Happening?’:
    return ‘Using gettext_with_context filter’;


    danbp
    Participant

    @danbp

    hi @gnfb,

    Basic PHP explanation.

    A case is the original context. This means while using a switch, if the function encounter the case ‘Side wide activity’, it return ‘Something’.
    If you switch to another case, for ex. ‘Groups’, itreturn ‘Bands’.
    And finally, if it find no case, it use the default variable $translated.

    So in the snippet you use:

            case 'Site-Wide Activity':  // used by default by BP
                return 'Whats Happening?'; // the wording you want to use instead

    Hope to be clear.


    Lars Henriksen
    Participant

    @adjunkten

    Thanks Shanebp and danbp – this worked for me, you guys rock!

    This finally translated ‘Groups’ and ‘Members’ on my site as well with just two more ‘cases’ in the code:

    function example_gettext_with_context( $translated, $text, $context, $domain ) {
    
         if ( 'buddypress' !== $domain )
            return $translated;
    
         switch ( $text ) {
    
            case 'Site-Wide Activity':
                return 'Historikeraktivitet';
            
            case 'Groups':
            	return 'Arbejdsgrupper';
            
            case 'Members':
            	return 'Medlemmer';
            	
    
            default:
                return $translated;
        }
    
        return $translated;
    }
    add_filter( 'gettext_with_context', 'example_gettext_with_context', 11, 4 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Edit buddypress.pot file’ is closed to new replies.
Skip to toolbar