How to edit PO/MO language files in BuddyPress plugins

po-moMany BuddyPress and WordPress plugins come with language files defining the text used throughout the plugin. In some cases you may want to edit the languages used, and this tutorial will explain how to do so.

The code used here is credited to Paul Gibbs, who was nice enough to help me figure out how to do this.

For this tutorial we will be editing the languages used in Paul’s Achievements plugin. You can use the same basic instructions for any other plugin that supports language files.

Language files explained

Language files are a bit extremely confusing at first. Bear with me. It will be worth it, I promise!

Any plugin that has support for language files will have a POT file, which can be used to create the necessary PO and MO files for your particular language. The PO/MO files allow you to take all of the text phrases from the original POT language file, and then provide your own translations for whichever phrases you’d like to adjust.

You will be creating PO/MO files from the included POT file, and these new PO/MO files will include your language translations. Once created, you only need to edit the PO file, as the software you will be using will auto-generate the corresponding MO file (MO files are similar to dark matter). From my understanding the PO (Portable Object) file is human-readable, and the MO (Machine Object) file is optimized to be machine-readable so it will load faster. BuddyPress will only actually be reading the MO file.

Every PO/MO file has a naming structure related to which language it is meant to be translated into., for example, is for French. To use US English, your files will need a naming structure including en_US.po and As I mentioned, confusing!

You can find some other country codes at this resource.

1. Get software for editing language files

You will need special software to edit your PO/MO files. The software I personally use is Poedit for Mac. It definitely leaves something to be desired, but gets the job done. The rest of this tutorial will assume you are using Poedit.

Software you may consider using to edit PO/MO files:

2. Create your language files

Once you have the necessary software installed, you should go ahead and download the POT file from the plugin. In this case, the file is called dpa.pot and is located at /plugins/achievements/

Note: If your language’s PO and MO files already exist in the language folder, you may download them directly and skip the following step of renaming the POT file.

Assuming you are translating for US English, rename dpa.pot on your local machine to dpa-en_US.po. Then open it up in Poedit or whichever software you decided to use. The software should display a bunch of lines of text which you can translate. Make your translations, and when you hit Save you will see a MO file auto-generated on your machine.

When you are finished editing your translations, upload both the PO and MO files (dpa-en_US.po and in this case) to /plugins/achievements/includes/languages/

3. Tell BuddyPress to use your language files

In order to use your fancy new language files, BuddyPress needs to be told which files to load.

You will need to add some code into your /plugins/bp-custom.php file. If that file does not exist, go ahead and create it.

Add the following code (assuming you named your files for US English):

if ( file_exists( WP_PLUGIN_DIR . '/achievements/includes/languages/' ) ) {

load_textdomain( 'dpa', WP_PLUGIN_DIR . '/achievements/includes/languages/' );

Your site should now be using your translated language files!

Have us edit your language files

Confused? We can edit your language files for you. Please tell us about your project.

9 thoughts on “How to edit PO/MO language files in BuddyPress plugins

  1. Leana

    Thanks so much for the instructions! I am trying to follow them, but every time I try to open my .po file, Poedit says “error: cannot convert file content to unicode”. Any idea on what may be causing this?

    Also, I have two .po files, one that is in English (en_US) and one that is in Spanish (es_CL). I need to publish my site in Spanish, but the Spanish file is not well translated. Should I go into the Spanish one in order to fix it or should I go into the English one and start from scratch?


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>