This post was originally published at LionVineyard.com on 2009/09/29
Twitter Tools by Alex King is an excellent WordPress plugin for interacting between your blog and twitter. It has many features like putting twitter updates on your blog, or updating (twitting) twitter every time you post something. And this is the feature that interests me and was causing problems with qTranslate.
If you are using qTranslate on your multilingual blog then the twitter update will look something like this:
New Blog Post: <!--:de-->Deutch Post Title <!--:--><!--:en-->English Post Title<!--:-->
This is first of all confusing also ugly. This is because Twitter Tools is not set up for multilingual blogs.
The solution is very easy. You will need to edit the twitter-tools.php file which is found in the twitter-tools directory in the plugins directory of your WordPress installation.
On Line 467:
It should look like this:
$tweet->tw_text = sprintf(__($this->tweet_format, 'twitter-tools'), $post->post_title, $url);
To fix the problem you will need to call GetText which in WordPress can be called via the shortcut __(). Thus Line 467 should be changed to:
$tweet->tw_text = sprintf(__($this->tweet_format, 'twitter-tools'), __($post->post_title), $url);
The __() function is added to $post->post_title which returns the portion of the title that corresponds to the current active language. Thus if English is active, then the update (twit) on twitter will look like this:
New Blog Post: English Post Title
Nice and clean!