Racing Minis at Zandvoort
Photo: Copyright © 2019 Eelke Blok

Translations broken on WooThemes Bueno

The past few days, I have been working on switching my girlfriend's new site - Mientje's Baksels - from wordpress.com to a self-hosted blog, using Wordpress 3's new multisite feature (this blog should move there soon too, I just have to sort out the domain transfer). The wordpress.com blog used WooTheme's Bueno theme, which we thought matched very well with the subject of her blog: cakes. Unfortunately, the theme didn't seem to pick up the Dutch language selection. Here's what was wrong with it, and what I did to fix it.

The first problem was the naming of the .mo files in the bueno/lang directory; these were are called bueno-<locale>.mo, e.g. bueno-nl_NL.mo (actually, that file didn't exist in my version, I had to copy the nl_BE file to get a Dutch translation, but that is a minor issue). The problem: Wordpress will look only for files named <locale>.mo. So, step 1: rename all your .mo files (or at least the ones you need) so they do not include the theme's name. The second problem is the way the theme tried to load the translation files:
load_theme_textdomain('woothemes');
This is on line 142 of bueno/functions/admin-setup.php. When calling the function like this, Wordpress will only look in the theme's root directory. The trick, of course, is to tell Wordpress to look in the directory in which the theme collects its translations. Step 2, change the offending line to this:
load_theme_textdomain('woothemes', get_template_directory() . '/lang');

Make these changes, and your Bueno theme will happily display localized text strings. (The same issue may be true for other WooTheme's Wordpress themes, I haven't checked).

Comments

Thank you so much, you really made my day!

Thanks a bunch! I use a self-hosted WP with free Wootheme, which has the same problem with the filenames. You saved my day!

WOOOW. It worked for my Diner theme. After 1 month of troubles I finally fixed it, phew. Thanks a lot Eelke !

On my side, I’ve put my “fr_FR.mo” in the root directory of my "theme" instead in the "lang" one inside the theme directory. Working well for me !

Sure, that should work too. I like to keep translation files separate from the other files, though.

Wow, thanks. So many websites checked, but they just explain how to edit .po files, nothing about to change admin-setup. Spent half day to find your solution!

Add new comment

Category