If you are not familiar with bbPress, in short, it’s a WordPress plugin that will turn your site into a forum-driven, full-featured system. You can read more and download it here.

Since you are reading this, most likely you already know at least one bbPress forum system – the WPML (very) active support forum. Yes, our sites run WPML and bbPress together on a big scale and it’s working nicely for us:


In the following document, I’ll explain shortly how you can have a multilingual WordPress forum system using bbPress just like ours.

What you will need

  • The bbPress plugin (version 2.5.12 or above)
  • A recent version of WPML (version 3.6.3 or above), including the String Translation and Translation Management add-on plugins

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.

Content

  1. Create your multilingual forum to have one forum per language
  2. Translate everything in your multilingual forum
  3. 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 language as Spanish. Let me show you step-by-step how this is done:

    Set Up

    1. Go to WPML -> Translation Management -> Multilingual Content Setup tab and set the Forums Custom Post to Translate.

    Set the Forums custom post to translate
    And now in Forums you should see the available languages added:

    1. Add a New Forum in your default language and Publish it.

    1. Now you can translate your forum to the other languages by clicking the plus button.

    Translate the forum by clickin the plus icon in the language box

    Add your translated text to the forum

    You are able to see all of the different forums in each language by clicking on the Forums menu link.

    Adding the correct forum to the WordPress navigation

    You’d probably like to add your forums to the WordPress navigation menu, and you would need to have each forum appear in the right language. Let’s see how this is done:

    1. Go to Appearance -> Menus.
    2. Click on Screen Options in the upper right corner and unveil the WordPress screen options settings.
    3. Mark Forums in the Boxes row.
    4. Add to the menu the Forum you created for this language, and click Save Menu.
    5. Add the forum to the menu

    6. Click the Synchronize menus between languages link. WPML will let you know that the correct forums are added to the other languages menus. Then click Save Menu.
    7. Synchronize menues between languages to add the secondary language forum to your secondary langauge menu

    OK, now that we are done setting up, there two more things that are helpful to know.

    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:

    bbPress front end translated

    There’s a good chance you’d like to change a few of those, so let’s see how this is done:

    1. Go to WPML -> Theme and Plugins localization and choose bbPress and click the Scan the selected plugins for strings button. WPML will scan all the translated strings that come with bbPress.
    2. Go to WPML -> String Translation.
    3. Paste the string you’d like to translate in the search field and click Search.
    4. Add your translated text, mark the Translation is complete option and click Save.

      Translating bbPress strings using the String Translation
      You can see the translated strings in my site’s front-end below.

    5. Translation showing on the front-end

    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>';
    }
    

    Now all you need to do is to customize the selector in your WordPress admin by going to WPML -> Languages -> Custom Language Switcher, and–voilà–you get this:
    Adding a custom language switcher

    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 here: https://github.com/OnTheGoSystems/bbpress-multilingual Then you will need to set the (Forums, Topics, Replies) custom post types to Translate. You can do this by navigating to WPML -> Translation Management -> Multilingual content setup tab then click on the Custom posts link.

    Translating everything in bbPress

    As always, if you have any issues or questions, head to our support forum and let us help you resolve them.