Automated page translation with Google

Walter Bright newshound at digitalmars.com
Thu Mar 22 15:27:15 PDT 2007


Pragma wrote:
> Walter Bright wrote:
>> I've been looking into adding buttons to the D web pages to do 
>> automatic translation to different languages. The trouble is, the 
>> google translator also attempts to translate the code blocks, 
>> resulting in a mess.
>>
>> Is there a css tag, hack, or trick to convince google translator to 
>> skip those sections?
> 
> I googled around for a bit and even tried to see how google's own source 
> snippets stand up to translation.  Apparently, it's a known issue.
> 
> The only thing I found was a reference to a <meta> tag attribute that 
> disables translation for the whole page:
> 
> http://www.google.com/help/faq_translation.html
> (bullet #13)
> <meta name="google" value="notranslate">

Oh well - of course it's quite useless to provide a translation button 
and then mark the whole page as notranslate!


> But there's nothing like <div google="notranslate">...</div> or somesuch 
> available that I could find.

Sigh. I couldn't find one, either, I was hoping I just overlooked the 
obvious.

> FWIW, I found a rather nice javascript widget here for translation 
> support that uses a drop-down instead of buttons. The page itself is a 
> live example of it in action (in the menu on the right):
> http://forwarddevelopment.blogspot.com/2006/12/add-translation-tool-to-your-blog.html 

That does work reasonably well. Thanks!



More information about the Digitalmars-d mailing list