I’d like to apologize to everyone who tried to view some of my images or download files from non-English translations of this site, as it appears this functionality has been failing for a little bit of time.  Seeing as how more than 70% of my site traffic is not in English, I should have noticed this a few months ago, so I can’t really give any excuses for my lapse in site management.

All the language translation done on this site is by Altavista’s BabelFish engine.  When you click on one of the flags in the upper portion of the side-bar, you’re actually making use of a great little WordPress plugin written by Davide Pozza.  I’ve been using his Global Translator plugin since January and it’s been a great boom for the reach of this website.  What I find absolutely incredible is the number of visitors from countries that I had never imagined accessing this site.

As of June 1, 2007, this site is read in mostly Spanish followed by English.  I’m really curious to know how well the BabelFish machine translation works.  If you happen to be reading this entry in something other than English, please let me know what you think.

Now, all that said, if you also happen to be using Global Translator and you’ve noticed that people are having trouble downloading .zip, .rar or other files, here’s how you can correct the issue.  Everything you need to change is in the translator.php file.  For those who do not want to manually edit the file, you can find a zipped version of the file at the end of this post.

First, we’ll add a definition to the file.  Shortly after the comment block, you’ll see several lines that start with the word “define”.  They’ll look something like this:  define(’FLAG_BAR_BEGIN’, ‘<!–FLAG_BAR_BEGIN–>’);

Add this right afterwards:

define(’EXT_EXCLUDE’, ‘.jpg|.png|.gif|.zip|.rar’);

If you have any other links or file types that also pass language pointers, feel free to add them here.  For exampe, if you have a link such as http://blog.org/ko/images/picture.bmp, you will want to add .bmp to the definition above.

Next, in function gltr_translate find the following line:

$line = preg_replace($pattern, $repl, $line);

You will want to add a condition around this to make it read:

if (strpos($line, EXT_EXCLUDE) > 0) {
  $line = preg_replace($pattern, $repl, $line);
}

This will ensure that lines with extensions found in EXT_EXCLUDE are not updated to have a language pointer in place.

Now, all this said, it wouldn’t be too hard (in theory) to make this something configurable in the Admin screens, but it’s outside the scope of what I was trying to solve at the moment.

For anyone that hasn’t tried Davide’s plugin and would like to offer their site in multiple languages, I’d strongly recommend Global Translator.  As of this writing, version 0.6.1 is out, which has support for caching, Google Translation, BabelFish Translation, and a few other great little features.

You can download my edited translator.php file here.

Note:  This file is for Global Translator version 0.6.1.