Adventures in Engrish
WordPress
Do You Still Want Gengo?
Jun 30th
Gengo was (and remains) a project that I am very fond of. Originally developed for my own personal use to blog in Japanese as well as English, it turned into a fairly full-featured plugin that was used by quite a few people. Unfortunately, time pressures meant that I had to drop support for it a few years ago. Even so, every few weeks I get an email or comment (usually nothing to do with the post it was written against!) asking me to consider restarting development.
It might just be the alcohol talking, or end-of-financial-year madness, but with WordPress 3.0 recently out and a couple of requests already this week, I’m seriously considering starting development again. I do have a couple of projects I want to do though, so I only want to dedicate time to Gengo if it’s going to be used. My Japanese has sadly diminished to the point where I’m practically mono-lingual again, so I’m not going to be blogging in multiple languages any time soon, and it would purely be for others to use. So, if enough people email me or comment in the next week or so, I’ll give it a crack. Second time around, I’ll hopefully be able to design it more cleanly and more quickly, and WordPress’ plugin architecture hopefully hasn’t changed too much while I’ve been away.
So if you want to see a new version of Gengo, please let me know. On the other hand, I hear very good things about WPML, so If Gengo’s time has passed, feel free to say that too! I won’t have hurt feelings, promise
Fixing Mystique for Backtype Connect
Feb 6th
I’ve been playing around with WordPress themes and plugins and one that caught my eye was Backtype Connect, which aggregates discussions from around the web and places them as comments onto the original post. Unfortunately it wasn’t playing nicely with the Mystique theme I’m currently using, with no comments showing and the sidebar not appearing on posts where there was a backtype comment.
It turned out to be a minor error in the Mystique theme, which deals with how CSS classes are assigned to the sections that display the comments. Mystique has the following lines of code at the bottom of its mystique_comment_class function:
$class = join(" ", $classes);
echo apply_filters("comment_class", $class);
Mystique is trying to do the right thing here, by allowing plugins to manipulate the classes with the ‘comment_class’ hook, just like WordPress’ own function. However, the code is turning the $classes array into a $class string and passing that to the plugins. Backtype Connect (and presumably other plugins) expect those classes to be passed as an array leading to the following error:
Fatal error: [] operator not supported for strings
However, because this error occurs within an HTML tag it isn’t rendered correctly, which means it is hard to spot. Nevertheless, it causes PHP to stop executing immediately, leading to half-rendered pages.
Luckily, the fix is simple. Simply join the array after the filter has been called and everything works well. Future revisions of the theme will probably fix this, but in the meantime, you can use the WordPress plugin editor to replace the two lines above in mystique/lib/core.php with the following:
$classes = apply_filters("comment_class", $classes);
echo implode(" ", $classes);
And they should live together in harmony.