Skip Navigation
Originally written
March 22, 2017
Updated
November 20, 2020

bbPress is a WordPress plugin that turns your site into a forum-driven system. With WPML, you can make your forum system multilingual.

You probably already know at least one multilingual bbPress forum system – the WPML support forum. Our sites run WPML and bbPress together to allow our clients to search for answers and seek support in their native language.

WPML’s multilingual support forum is built using bbPress
WPML’s multilingual support forum is built using bbPress

In the following document, we’ll walk through how to create a multilingual WordPress forum system using bbPress just like ours.

What you need

  • The bbPress plugin (version 2.5.12 or above)
  • Multilingual CMS version of WPML. Install the WPML core plugin plus String Translation, Translation Management, and Media translation add-ons.

Essential resources

  • WPML’s Getting Started Guide helps you in setting up WPML in a few minutes. You will want to refer later to some of its subtopics, such as String Translation. We recommend that you keep this guide open while following this tutorial.
  • The bbPress documentation will provide you with all the information you need to create and manage your forum.

WPML translation tools

WPML offers two translation editors you can use for translating your site’s content:

Besides translating your site content yourself, you can also:

Content

There are two scenarios when you are creating a multilingual forum system:

  1. One forum per language – This is the most likely scenario.  We will have one independent forum for each language, which means we translate only the forums post types. This is how we run WPML support forums.
  2. Translating everything – In some cases, and usually if you are using bbPress not for its strictly original purpose, you might want to translate everything (forums, topics, replies).

One forum per language

In this case, we just need to have one support forum in each language, independent from one another. In other words, we don’t want to translate all the contents of the forums to the different languages.

In the following example, I have set my site’s default language as English and the secondary languages as German, French, and Polish. Let me show you step-by-step how this is done:

Set Up

  1. Go to WPMLSettings page. Scroll down to the Post Type Translations section, and set the Forums custom post type to one of the Translatable options. Click Save.
  2. Marking the Forums custom post type as Translatable
    Marking the Forums custom post type as Translatable
  3. Add a New Forum in your default language and Publish it.
  4. Creating a new forum in English, our default language
    Creating a new forum in English, our default language
  5. To translate the forum yourself, click the plus icon in the Languages meta box.
  6. Click the plus icon to translate the forum text yourself
    Click the plus icon to translate the forum text yourself

    This opens the Advanced Translation Editor where you can add your translations.

    Translating the forum text in the Advanced Translation Editor
    Translating the forum text in the Advanced Translation Editor
  7. To send your forum to be translated by a local translator, professional translation service, or translate multiple forums in bulk, start by going to WPMLTranslation Management. Select Forum from the dropdown menu, and add your selected forums to the Translation Basket.

    Adding forums to the Translation Basket to be translated by professional translation services, local translators, or translate in bulk
    Adding forums to the Translation Basket to be translated by professional translation services, local translators, or translate in bulk

You can see all of the different forums in each language by clicking on the Forums menu link, then selecting All languages.

Viewing all forums after translation
Viewing all forums after translation

Adding the correct forum to the WordPress navigation

Next, we’ll walk through adding your forums to the WordPress navigation menu, and how to have each forum appear in the right language.

  1. Go to Appearance Menus.
  2. Click on Screen Options in the upper right corner to show the WordPress screen options settings.
  3. Mark Forums in the Boxes row.
  4. Adding Forums to the screen options
    Adding Forums to the screen options
  5. Add the default language forum to the menu and click Save Menu.
  6. Adding the forum to the menu
    Adding the forum to the menu
  7. Click the Synchronize menus between languages link. WPML shows you which items will be added or updated in your secondary language menus. Click Sync and Apply Changes to update them.
  8. Adding the translated forums to your secondary language menus
    Adding the translated forums to your secondary language menus

Translating bbPress texts (strings)

bbPress comes with its own translations, included in the bbPress MO file. This means that after you have followed the above steps you already have most of the default bbPress strings translated to your site’s secondary languages, as you can see below:

Translations from bbPress’s included MO file
Translations from bbPress’s included MO file

If you would like to change any of the string text, you will need to update the translations by following these steps:

  1. Go to WPMLTheme and Plugins localization. Select bbPress from the Strings in the plugins section, and click the Scan the selected plugins for strings button. WPML will scan all the translated strings that come with bbPress.
  2. Scanning bbPress for strings
    Scanning bbPress for strings
  3. Go to WPMLString Translation.
  4. Paste the string you’d like to translate in the search field and click Search.
  5. Add your translated text, mark the Translation is complete option and click Save.
  6. Updating the translation of a string
    Updating the translation of a string

You can see the translated strings on the site’s front-end.

Viewing the updated string
Viewing the updated string

When people enter one of your support forums it can be very helpful to show them a list of all the forums available in the other languages–we do that in our forums.

To achieve that you will need to add a small piece of code to your theme’s functions.php file, using the bbPress API library. The action we are using is bbp_template_before_single_forum. You can see an example of how to use it here.

Then, we inject the WPML language selector action called wpml_add_language_selector.

Below you can see the complete snippet:

add_action( 'bbp_template_before_single_forum', 'show_available_languages' );
function show_available_languages() {
    echo '<div class="available_languages">';
    _e( 'Support is also available in these languages:', 'bbpress' );
    do_action( 'wpml_add_language_selector' );
    echo '</div>';
}

Finally, you can customize how the language selector looks by going to WPML Languages and adjusting the settings in the Custom Language Switchers section.

Customizing the language switcher settings
Customizing the language switcher settings

Translating everything

Although this isn’t the most common scenario, some clients have asked us if it’s possible to translate everything coming from bbPress (topics and replies included). So we wrote a small bridge plugin that you can get from our github repository.

After installing and activating the plugin, set the Forums, Topics, and Replies custom post types to Translatable. You can do this by navigating to WPMLSettings. Scroll down to the Post Types Translation section and select one of the translatable options.

Setting the bbPress custom post types as translatable
Setting the bbPress custom post types as translatable

Once these post types are translatable, you can translate them the same way as explained with the Forum post type earlier in this article.
As always, if you have any issues or questions, head to our support forum and let us help you resolve them.