Program to Translate English Text To Bengali through Google Transliterate API

Rajnilari2015
Posted by Rajnilari2015 under JavaScript category on | Points: 40 | Views : 779
<html>

<head>

<title>Translate English To Bengali through Google API</title>

<script type="text/javascript" src="http://www.google.com/jsapi"></script>

<script type="text/javascript">

// Load the Google Transliterate API
google.load("elements", "1", {packages: "transliteration"});

</script>

<script>
function OnLoad(chooseLanguage) {

//Make the options
var options = {
sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,

destinationLanguage: [google.elements.transliteration.LanguageCode.BENGALI],

shortcutKey: 'ctrl+g',

transliterationEnabled: true
};

// Create an instance of TransliterationControl with the needed options.
var control = new google.elements.transliteration.TransliterationControl(options);

// Enable transliteration in the textbox with id 'txtInput'.
control.makeTransliteratable(["txtInput"]);

} //end onLoad function

//Invoking the onLoad handler
google.setOnLoadCallback(OnLoad);

</script>

</head>

<body> Type In English and the code will be translated in Bengali: <input size="40" type="text" id="txtInput"/></body>
</html>

Comments or Responses

Login to post response