Google Website Translator and Skipping Translation Segments

By Akbar

I have been using the Google Website Translator widget on my website for few years, and I’m quite happy with that. The machine translation is not very accurate, but it does provide some help in case someone doesn’t know the target language at all.

Plus, I had also been using the Google Translate API for my Dynamic Subtitles Translator product for a year or so, and then Google decided to discontinue that service and made it Paid only. I tried going with Microsoft Bing Translator, and though it’s free, it has monthly traffic limit. So, at the end, I have to revert back to Google Website Translator widget which do the job, but then it translate all the page, and not just the subtitles I want to translate, and it looks quite bad in the end.

Today when inspecting the Google Translator header widget, I found something interesting and that’s the wrapper DIV and IFRAME elements of the Google Translate bar has the CSS class of “skiptranslate”. My hunch was that this is something which is preventing the translation of this block on the page. So, I quickly tested this and applied this class to few of my DIV elements, and sure enough, this did the job.

So, at the end, I just added the “skiptranslate” to all the elements other than subtitles which needs to be translated, and this works great. You can view this at:
http://www.syedgakbar.com/products/dst/

Tags: , ,