Tuesday, April 17, 2007

Google Translator Mashup - Another Gen

Well after a little break from working on my Google Language Translator drop-in tool for web pages I have came back and simplified things a bit.

IE7 created a new bug and I moved some of the code around and embedded the style sheet to make this tool more portable. This latest version can be dropped into any web page with only two JavaScript files references and one span tag for the toolbar placement and some class attributes added to the regions that you want translated.

The current shared version has a limit of about 2000 characters since it's "Google Translate Request" uses a Query String that gets sent across the wire but you can work around this by breaking up and using multiple span/div tags with the translator attribute.

If you are doing you own hosting with local web page you can work aound this limitation by writing your own Proxy Web Page like the ASP.Net example

Found on the top of this Blog is a Drop-Down language selection toolbar. Select one and then click on the refresh icon at the right to make the element with the HTML class attribute of "translator" self translate.
    These are the HTML JavaScript's files required
    <script src="http://code.jquery.com/jquery-latest.pack.js" type="text/javascript"></script>
    <script src="http://softwarecommunity.intel.com/isn/home/translator.js"type="text/javascript"></script>

    For the Toolbar just drop the following code into the page
    <span class="globalLocalizerToolBar"></span>

    For each element that you want to auto-translate use a span or div tag with the "translator" attribute to surround the text.
    <span class="translator">this text would translate</span>


No comments:

Blog Archive