Over the weekend Brad sent me a comment that Fred Wilson got on his blog about using Google's page translation service. After poking around inside Apache for a while I got the redirect issue worked out so that it would translate his site correctly. This gave me the idea to write a small select box that would let users quickly translate any page on the site to the language of their choice. This turned out to be extremely simple so I figured I'd share. Here's the Javascript/HTML code for it:
<select name="translate" style="height:18px; font-size:10px;" onchange="javascript:window.location = 'http://www.google.com/translate_c?hl=en&langpair=en%7C' + this.value + '&u=' + window.location.href;">
<option value="">Translate This Page</option>
<option value="ar">Arabic</option>
<option value="zh-CN">Chinese Simplified</option>
<option value="zh-TW">Chinese Traditional</option>
<option value="nl">Dutch</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="pt">Portuguese</option>
<option value="ru">Russian</option>
<option value="es">Spanish</option>
</select>
Just paste that code in anywhere you'd like the translation box to appear. You'll notice I was semi-lazy and styled it right here in the code, that was just to make it easier for you to cut-and-paste in. Pretty simple but potentially very useful addition I think.
Posted in: Technology

