Changing the text used in BuddyPress and other Plugins

A common requirement is to add or change text that is displayed in Buddypress pages, for example changing the text displayed on the registration form. To do this a technique involving the language translation files is used, details located here:

https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/

There is also a plugin that helps you manage your customisation files called Wpt-Custom-Mo-File.

This article will show you how to change labels and messages used in BuddyPress and introduces the WordPress way to perform language localisation, in this case we will be localising your own local language.

The standard for WordPress translations is that each plugin comes with .pot translation files for each language that is supported. You can modify these files in order to create your own local translations of the plugins in the form of .po and .mo files as desired using the Poedit tool, WPT Custom Mo File allows you to upload your custom translation (.mo) file into WordPress thus creating your own custom translations.

What this is particularly useful for when you wish for content strings within your default language to be phrased differently.

Installing Poedit

You can download and install Poedit by visiting the Poedit website and downloading the installation files then running the installer. Poedit is free to use.

Installing WPT Custom Mo File

As with all plugins listed in the WordPress Plugin Directory, it is very easy to install WPT Custom Mo File, you simply go to you Dashboard and select Dashboard>>Plugins>>Add New, then type in WPT Custom Mo File in the search bar. the plugin will be displayed and you can click on Install and then Activate.

Changing BuddyPress Labels and Messages

The first step is to take the BuddyPress master language file (buddypress.pot) and to make your own language file.

Copy /wp-content/plugins/buddypress/buddypress.pot to your local computer and rename it to buddypress-en_US,po

This gives you a master po file that you can edit.

Next, open Poedit and open buddypress-en_US.po

You will see that All of the available messages and labels are listed within the Poedit application, you can scroll through these and find the messages that you would like to change, then it is a case of entering the required translation into the Translation box.

Once you have completed this process, selecting save will create a new file called buddypress-en_US.mo, this is all of your specific translations saved into one file.

Next to upload your translations to your site, you will use WPT Custom Mo File, to do this, from the go to Dashboard>>Tools>>WPT Custom Mo File. Here you can select the Plugin to translate (text domain) and the language you are translating. In this case it is BuddyPress Text Domain and English US as the language. Then you can select the local .mo file to upload and select “Add New Rule“.

Once you have added the rule, it will appear in the configured rules list and you have options to delete the rule or deactivate it.

Your translation should now be enabled and you can go to your front end and check it has worked.


Venutius

I've been setting up and managing BuddyPress social networks for a few years. I moved from Ning and other platforms and have come to BuddyPress looking to make sites with similar features to them.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Contact Me
close slider