Skip to:
Content
Pages
Categories
Search
Top
Bottom

Tutorial: How to edit or translate words in BuddyPress


  • modemlooper
    Moderator

    @modemlooper

    It’s not that difficult to change words when you know how. I’ll step you through it.

    This is what localized text looks like in BuddyPress theme files _e( ‘Home’, ‘buddypress’ ). This allows BuddyPress to be translated into any language just by adding a file. You can also change the names of Groups to something else that better suits your network. Maybe you want teams instead.

    What is this localized text?

    The first part ‘Home” is the word or string that can be translated or changed. The second part ‘buddypress’ is used to say I want anything with this attached to use this language. WordPress scans through and everywhere ‘buddypress’ is it will swap out the first part with your word from a .mo file.

    You need Poedit

    http://www.poedit.net/download.php

    Download, install and open.
    Then you click file and choose – New catalog from pot file.
    Search for the buddypress.pot file. You can find it in the buddypress plugin folder inside bp-languages. This file has all the text that can be localized or changed that is located within the BuddyPress default theme. Poedit allows you to scroll through all the text and then change it.

    Screen shot 2011-01-12 at 4.55.14 PM

    Make all your changes by scrolling through list of strings and then adding yours below. When your done hit save. Save your file to something like buddypress-mychanges.po. Poedit will create another file with a .mo extension. This .mo file is actually the file that WordPress will read. It’s a better and faster file that computers can drill through. That way when you load a page the translation is instantaneous.

    Finally you upload the files, buddypress-mychanges.po and buddypress-mychanges.mo to the same folder as buddypress.pot was that you first opened.

    Ok, now we need to tell BuddyPress to use your custom language file. If you do not have a file called bp-custom.php in your wp-content/plugins folder then add one and then add the following code to it:

    <?php
    if ( file_exists( WP_PLUGIN_DIR . '/buddypress//bp-languages/buddypress-mychanges.mo' ) ) {

    load_textdomain( 'buddypress', WP_PLUGIN_DIR . '/buddypress//bp-languages/buddypress-mychanges.mo' );
    }
    ?>

    Test your site, you should now see changes. You can easily change future text by opening the buddypress-mychanges.po file and hitting save again. Each time you save it will create a new .mo file that WordPress will read.

    Need help? Comment below.

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

  • pcwriter
    Participant

    @pcwriter

    Great tutorial @modemlooper, simple and to the point. Thanks! :-)

    @modemlooper you’ve gone and duplicated effort here! I had written up an explanation for using poedit a while ago and added it to the codex on the language page.


    modemlooper
    Moderator

    @modemlooper

    @hnla I read it and people still keep asking. I broke it down more into steps instead of large paragraphs. People need bullet point instructions or they turn off.

    If they do turn off then they don’t deserve to understand, and good luck to them! There is a danger in pandering to those that want things spelled out in too much of an idiot fashion, My steps were verbose but accurate if followed, which sadly does mean a certain amount of application of effort on the part of the reader *sigh*


    modemlooper
    Moderator

    @modemlooper

    @hnla you are very right. I was just adding localization to plugins and then it was asked twice on here so thought I’d post it up.

    Hi,

    Thanks, your instructions seem simple enough but i get the following msg after uploading a file called bp-custom.php to the buddypress plugin folder exactly as you said:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /srv/samenm3/www/www.samenmetkok.nl/wp-content/plugins/bp-custom.php on line 1

    What does that mean?

    Thank you!!


    modemlooper
    Moderator

    @modemlooper

    Upload bp-custom to wp-content/plugins/bp-custom.php

    not the BP plugin folder


    @mercime
    Participant

    @mercime

    === syntax error …. on line 1 ==

    open up your bp-custom.php file and make sure at the top that there’s an opening
    `<?php`
    without any space or line before that.

    At the bottom, make sure that you have a closing
    `?>`

    Hi I am not sure what I did wrong and its not working properly…

    I got the errors everything after i post a forum topic.. The new translation is done but I got this error….

    Warning: Cannot modify header information – headers already sent by (output started at /home/footheal/public_html/commandoclub.net/wp-content/plugins/bp-custom.php:8) in /home/footheal/public_html/commandoclub.net/wp-includes/pluggable.php on line 897

    Please help.

    Still not having luck with this. I want to change the page title from Groups Directory to Groups.

    Ive follwed the instructions to a T. Not getting an error. Not updating.

    Any ideas.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Tutorial: How to edit or translate words in BuddyPress’ is closed to new replies.
Skip to toolbar