Friday 26 April 2013

Translate English text to Telugu text -javaScript

We can able to translate English text to Telugu by using below code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>Telugu Script Writing</title>   
    <script type="text/javascript" src="https://www.google.com/jsapi?key=ABQIAAAA1shzMbB68tKmVYtlEvxophR3XPuax6588beMf7ljLyU2XHTjmxRYQQJH0SqxG0X2uWOjRsedlEn2VQ">
    </script>
    <script type="text/javascript">
        // Load the Google Script Writing API
        google.load("elements", "1", {
            packages: "transliteration"
        });
        function onLoad() {
            var options = {
                sourceLanguage: 'en', // or google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage: ['te'], // or [google.elements.transliteration.LanguageCode.HINDI],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };
            // Create an instance on Script WritingControl with the required
            // options.
            var control =
            new google.elements.transliteration.TransliterationControl(options);

            // Enable transliteration in the textfields with the given ids.
            var ids = ["transl1"];
            control.makeTransliteratable(ids);

            // Show the transliteration control which can be used to toggle between
            // English and Hindi.
            control.showControl('translControl');
        }
        google.setOnLoadCallback(onLoad);
    </script>
</head>
<body>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-2872878-15']);
        _gaq.push(['_trackPageview']);

        (function () {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>
    <div id="page">
        <script type="text/javascript">
        </script>
        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
        <div class="content">
            <center>
                <b>Write your Name and Press Enter</b>:<br />
                <input type='textbox' class="bigtext" id="transl1" style="width: 500px; height: 300px;" />
            </center>
        </div>
</body>
</html>

No comments: