Created
April 1, 2015 07:43
-
-
Save sonukumaramarjeet/1bf8e71031fc1208390c to your computer and use it in GitHub Desktop.
How to use Google Language translation API For English To Hindi in asp.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HindiTranslation.aspx.cs" Inherits="AngularJsDemo.HindiTranslation" %> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>Change Language</title> | |
<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
// Load the Google Transliterate API | |
google.load("elements", "1", { packages: "transliteration" }); | |
google.setOnLoadCallback(onLoad); | |
function onLoad() { | |
var options = { | |
sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH, | |
destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI], | |
transliterationEnabled: true | |
}; | |
// Create an instance on TransliterationControl with the required options. | |
var control = new google.elements.transliteration.TransliterationControl(options); | |
// Enable transliteration in the text area and textbox with id | |
// 'transliterateTextarea'. | |
control.makeTransliteratable(['transliterateTextarea', 'txtuname']); | |
} | |
</script> | |
<style type="text/css"> | |
#transliterateTextarea | |
{ | |
height: 87px; | |
width: 289px; | |
} | |
</style> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<br /> | |
<textarea id="transliterateTextarea"></textarea><br /> | |
<asp:TextBox runat="server" ID="txtuname"></asp:TextBox> | |
</div> | |
</form> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment