October 8th, 2015 Add Your Comments Bookmark and Share

Back around 2005/2006 when Blogging was really taking off there was a phase where everybody got in to language translation. Automated translation tools were all over the place. What was seen as a massive SEO boost was quickly shot down by Google who found it very easy to detect the often badly auto translated pages. Ever since there have been a few attempts at making a SEO friendly translation tool but none have really succeeded. So me being me I decided to take what was the best of a bad bunch and get it actually working. If you’ve tried using Transposh but are getting duplicated titles, descriptions and any other number of “HTML Improvements” appearing in your Google webmaster tools then this post is for you!

What Is Transposh?

Transposh is a WordPress plugin that handles multi-lingual translation of your web pages on the fly. If you’ve ever wanted to target Russian, Chinese, Spanish or French traffic then Transposh should in theory be right up your street. There are 2 versions of the plugin, both are free. The version you’ll find openly on the web is the restricted version that only allows translation in to up to 5 languages and has restrictions on the widget that is available. By hitting a checkbox in the cut down version control panel you can then update to the fully unrestricted plugin from within WordPress itself. The fixes I talk about are only applicable to the full version, after all they’re both free so why use the limited plugin?

Transposh Problems – Duplicate Meta Descriptions And More

We all know that by default WordPress doesn’t have the facility to add SEO friendly meta descriptions to posts. For this we use plugins such as All In One SEO, Yoast SEO or Platinum SEO. Transposh “should” translate these extra meta fields (along with the rest of the content) the first time the page/post is requested in whatever language is being selected. IF this worked the problem would be that until a time where your page was visited by a visitor requesting each language you will end up with a lot of duplicate content (Side note: this doesn’t work, no meta description translation is done no matter how many times you re-load a page). Transposh thought of this, there are 2 functions within the plugin to help. You can enable auto translation on publishing, so that when you publish a post it is automatically translated in to every language…sweet! The other function is a tool that allows mass translation of all your content i.e. for any old posts. The mass tool uses the publish function for each post of your blog. I hope all this is making sense? The problem is that the publish function makes no account of the extra information added by All In One SEO, Yoast SEO, Platinum SEO etc etc Even if you use the auto translate on publishing option or the mass translation tool you will still end up with a shed load of HTML duplicate meta description (and title if you create custom titles within the SEO plugins) warnings within webmaster tools. It’s a shame, by using Bing for the translation and with the automated options within Transposh we are so close to a very good SEO friendly Translation plugin. So close that I thought it was worth the extra effort to fix what is wrong with Transposh.

Fixing Transposh

To get the plugin working requires delving in to the PHP code and you do that at your own risk. Seriously don’t come crying to me if you screw up your blog! If you’re not happy messing with PHP then find somebody that is. The PHP file that contains the code for auto-translating when a post is published is transposh_postpublish.php

Once in there you will find a block of text like the following (remember this is for the full plugin, not the restricted version):-

$parser = new parser();
$phrases = $parser->get_phrases_list($content);
$phrases2 = $parser->get_phrases_list($title);
$phrases3 = $parser->get_phrases_list($the_content_feed);
$phrases4 = $parser->get_phrases_list($excerpt);
$phrases5 = $parser->get_phrases_list($excerpt_rss);

// Merge the two arrays for traversing
$phrases = array_merge($phrases, $phrases2, $phrases3, $phrases4, $phrases5);

What this does in short is gather a group of phrases for translation. What we need to do is add any extra phrases that will be contained in the post meta (each of the popular SEO plugins stores their info in the post meta table). If we alter the above to:-

$parser = new parser();
$phrases = $parser->get_phrases_list($content);
$phrases2 = $parser->get_phrases_list($title);
$phrases3 = $parser->get_phrases_list($the_content_feed);
$phrases4 = $parser->get_phrases_list($excerpt);
$phrases5 = $parser->get_phrases_list($excerpt_rss);
$phrases6 = $parser->get_phrases_list(get_post_meta($postID,’description’,true));

// Merge the two arrays for traversing
$phrases = array_merge($phrases, $phrases2, $phrases3, $phrases4, $phrases5,$phrases6);

We have now added any meta “description” entries for this post to the list of phrases to be translated. Lower case description is the label that Platinum SEO uses, Yoast and All-In-One have their own (for example Yoast is _yoast_wpseo_metadesc ). You’ll need to check for these yourself in the wp_postmeta table. Also if you are using the SEO plugin to have custom titles, keywords then these will need to be translated as well so just add another $phrases7, $phrases8 etc entry for them and add to the array_merge.

At this point when a post is published we’ll now have our meta descriptions/titles/keywords translated by Transposh as well. Because the mass translation tool also uses this code any old posts will now be fully translated.

It was at this point that I discovered another problem with the full Transposh plugin that wasn’t there in the restricted one. All translations using this method are being stored Base64 encoded. We have one more alteration to make.

Change this:-

// only if a languages list was created we’ll need to translate this
if (@is_array($json[‘p’][$key][‘l’])) {
$json[‘p’][$key][‘t’] = transposh_utils::base64_url_encode($key);
@$json[‘length’]++;
}

To this:-

// only if a languages list was created we’ll need to translate this
if (@is_array($json[‘p’][$key][‘l’])) {
$json[‘p’][$key][‘t’] = $key;
@$json[‘length’]++;
}

And that’s us done. As close to a SEO friendly automated translation tool as you’re likely to find. You’ll still see the odd HTML warning in webmaster tools but I’ve used this on half a dozen blogs and literally thousands of posts and I can count the duplicate title and meta warnings on one hand. In terms of SEO does all this deliver more traffic? YES, YES and YES.