Bogo – Underrated Language Switcher / Multilingual Plugin

Bogo is solid, reliable and conflict-free multilingual plugin. It duplicates your post and uses URL Rewrite to serve the correct translation.

Whenever I like a plugin, I usually check out other plugins that are made by the same developer.

From that, I found a hidden gem called Bogo, a multilingual plugin made by Contact Form 7‘s developer.

How it Works

Instead of using custom database tables (like other competing plugins), it duplicates the Page and assigns the same URL slug. It’s normally not allowed by WordPress, but the plugin overrides that restriction.

Then visitors can choose the language by clicking the switcher created by the shortcode [bogo].

Now your site will serve the post with the chosen language. Additionally, your Blog Index page will only list translated posts.

Language Switcher created by the shortcode [bogo]

Setup Process

  1. Download and install Bogo. Go to the new “Languages” tab and choose the supported languages.
Activate supported language
  1. Edit an existing post or page. You will find a new section in the sidebar to add a translation. Click the button to duplicate the post or page.
Click the annotated button to add translation
  1. Lastly, edit the duplicated post or page and manually translate the text. Do not change the URL slug since it can break the language switcher.
Manually translate the post and publish it.

Customization

Unfortunately, this plugin doesn’t have many hooks. The only useful one I found is removing the flags:

add_filter( 'bogo_use_flags', '__return_false' );

But it’s not hard to create a custom HTML markup from scratch:

add_shortcode( 'bogo-dropdown', 'my_bogo_shortcode' );

function my_bogo_shortcode( $atts ) {
  if( !function_exists( 'bogo_language_switcher_links' ) ) { return; }

  $links = bogo_language_switcher_links( $args );
  $count = 0;
  $output = "<select onchange='this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);' >";

  foreach( $links as $link ) {
    // abort if empty href
    if(empty( $link['href'] )) { continue; }

    $extra = '';
    if ( get_locale() === $link['locale'] ) {
      $extra = 'selected disabled';
    }
    
    $output .= "<option value='{$link['href']}' {$extra}> {$link['title']} </option>";
    $count++;
  }

  $output .= "</select>";

  // if only 1 language, output nothing
  if( $count <= 1 ) {
    return '';
  }

  return $output;
}

Then replace the old shortcode with the new one called [bogo-dropdown].


Conclusion

Bogo has been my go-to multilingual plugin for years. It is solid, reliable and conflict-free.

It doesn’t try to do fancy stuff like creating a custom Database table. Everything is just a plain post and URL rewrite.

Even if you deactivate the plugin, your translated posts and pages are still there. Although it’s not visible via front-end.

Feel free to ask any question regarding Bogo in the comment below 🙂

Default image
Henner Setyono
A web developer who mainly build custom theme for WordPress since 2013. Young enough to never had to deal with using Table as layout.
Leave a Reply