Mostly about my amusement

Tag: translate (page 1 of 1)

Problems with machine translation

The machine translation I am using is giving me problems.  More accurately Google thinks my server is a compromised machine with spyware and BabelFish changed something so my pages are not being translated.

I’m not complaining because both service are free and reminds me of why some people really dislike machine translation.

For now I’ll turn off the plugin.  the translated URL’s (http://blog.dembowski.net/de/ for example) takes the user to the original article, so this is not really a big deal.

Translator plugin notice in javascript

Updated: I’ve rearranged the code a little bit so that I could selectively translate parts of the notice. The updated javascript sections is located here.

– – – – – – – – – – – – – – –

I had to switch back to the old copy of the ATPP WordPress plugin. My problem is most likely due to a configuration problem on my end, but I was getting hammered by HEAD and GET requests from Babelfish and WorldLingo.

I managed to add some javascript to my sidebar so that browser URL is compared with the URL the server thinks it served. If the two are different then the page is translated and a notice is displayed.

Here is the code.

<script type=”text/javascript”>
<!–
var browser_url = location.pathname
var server_url = “<?php echo(@$_SERVER[‘REQUEST_URI’]); ?>”
var orig_link = “<?php bloginfo(‘url’);echo(@$_SERVER[‘REQUEST_URI’]); ?>”
if ( browser_url !== server_url )
{
document.write(‘<div class=”trans-notice”>’)
document.write(‘<p>Please note: This page was originally written in English.</p>’)
document.write(‘<p>The text has been translated using an online service such as Google or Babelfish.</p>’)
document.write(‘<p>The original page can be viewed <a href=”‘,orig_link,'”>here</a>.</p>’)
document.write(‘</div>’)
document.write(‘<br />’)
}
//–>
</script>

If you click on http://blog.dembowski.net/archives/de/ the server will still see it as http://blog.dembowski.net/archives/ (without the /de/ at the end). The browser will see the real URL with the /de/ and compare what the server is reporting. If the two are different then the notice is displayed.

The notice will also be displayed if someone used /?p=123 to access a post. That’s not how my permalinks are setup so I’m not concerned about it.

Translator plugin problems

Well be careful what you wish for. The new version of the translator plugin has a load balancing/fail over option so that if the primary translator is unavailable and does not respond in time then the request gets sent to the next translation engine.

That is a very cool option. It also means your webserver gets hit massively by the translation engines. My web traffic went from 5,000 hits (900 visits) last week to 21,000 hits yesterday.

In terms of network traffic that’s not even 100kbs. In terms of application hits (Apache web server) that’s huge. I’ve rolled back the version from 5.01 back to 4.0. I had to load up phpmyadmin and zap the options from the plugin to get 4.0 working again.

The new version has some very cool options. If I can turn off the load balancing and set the error page that comes up to my own page then I’d be set.

I’ll e-mail the author and get it sorted out.

Update: I’ve found the problem.  It had nothing to do with ATPP, it was how I configured my logging software.