In this article I will illustrate how to convert text from one language to another in JavaScript.It can be achieved using Google API’s. There are many versions of API’s released.
here in this example i will use “jsapi” by referring following link in my web page.
<script type="text/javascript" src="https://www.google.com/jsapi">
else one can download java script file from the above link and reference it in the page.
Ex: Suppose we have two textboxes , one for entering English text and the other to display translated text. Enter text in English and press tab , converted text will appear in another textbox.
ASPX Code :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ex.aspx.cs" Inherits="Ex" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="https://www.google.com/jsapi">
</script>
<script type="text/javascript">
google.load("language", "1");
function myfunction() {
var filed = 'txtEng'
var strEngName = document.getElementById(filed).value;
var strEngArray = new Array();
strEngArray = strEngName.split(" ");
var str = '';
if (document.getElementById('txtEng').value.length == 0) {
document.getElementById('txtTel').value = '';
}
document.getElementById('txtEng').value = document.getElementById('txtEng').value.replace(/^\s+|\s+$/g, '');
for (i = 0; i < strEngArray.length; i++)
{
var temp = strEngArray[i];
google.language.transliterate([strEngArray[i]], "en", "te", function (result)
{
if (!result.error) {
var container = document.getElementById('txtTel');
if (result.transliterations && result.transliterations.length > 0 && result.transliterations[0].transliteratedWords.length > 0) {
container.value = result.transliterations[0].transliteratedWords[0];
str = str + ' ' + container.value;
}
document.getElementById('txtTel').value = str;
}
}
);
}
}
google.setOnLoadCallback(myfunction);
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tbody>
<tr>
<td>
Enter the Name(English)
</td>
<td>
<input id="txtEng" style="background-color:pink;width:380px; height:30px;font-size:18px;font-weight:bold" onblur="javascript:myfunction();" />
</td>
</tr>
<tr>
<td>Translated Text: </td>
<td>
<input id="txtTel" style="background-color:yellow;width:380px; height:50px;font-size:18px;font-weight:bold" />
</td>
</tr>
</tbody>
</table>
<br>
</div>
</form>
</body>
</html>
OUTPUT :
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
ReplyDeleterpa training in chennai | rpa training in chennai
rpa training in pune | rpa online training | rpa training in bangalore
This comment has been removed by the author.
ReplyDeleteThis is a nice post in an interesting line of content.Thanks for sharing this article, great way of bring this topic to discussion.
ReplyDeleteData Science training in kalyan nagar | Data Science training in OMR
Data Science training in chennai | Data science training in velachery
Data science training in tambaram | Data science training in jaya nagar
It was worth visiting your blog and I have bookmarked your blog. Hope to visit again
ReplyDeletejava training in chennai | java training in bangalore
java online training | java training in pune
Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
ReplyDeletepython training in pune | python training institute in chennai | python training in Bangalore
This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me..
ReplyDeleteBest Devops Training in pune
Devops interview questions and answers
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteAmazon Web Services Training in Velachery, Chennai |AWS Training in Velachery , Besant Technologies
Amazon Web Services Training in Chennai | AWS Training in Chennai
Amazon Web Services Training in Chennai |Best AWS Training in Chennai
Amazon Web Services Training in Chennai | AWS Training in OMR,Chennai
Amazon Web Services Training in Tambaram, Chennai|Best AWS Training in Tambaram, Chennai
Hello! This is my first visit to When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several your blog!
ReplyDeletefire and safety course in chennai
Thanks For Sharing The Information The information shared Is Very Valuable Please Keep Updating Us Time just went On reading The article Python Online Training Aws Online Training Hadoop Online Training Data Science Online Training
ReplyDelete
ReplyDeleteGreat Post,really it was very helpful for us.
Thanks a lot for sharing!
I found this blog to be very useful!!
JAVA training in Bangalore
Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
ReplyDeletepython training in bangalore
http://sailajareddy-technical.blogspot.com/2014/08/transliteration-javascript-example.html
ReplyDeleteThis technical blog really useful!!Thanks for your good sharing!!
ReplyDeleteAndroid Training in Chennai | Certification | Mobile App Development Training Online | Android Training in Bangalore | Certification | Mobile App Development Training Online | Android Training in Hyderabad | Certification | Mobile App Development Training Online | Android Training in Coimbatore | Certification | Mobile App Development Training Online | Android Training in Online | Certification | Mobile App Development Training Online
I really appreciate your help with my Gangubai Kathiawadi project!
ReplyDeletekralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
R8FXU
Nice blog.Keep posting.
ReplyDeletesql courses in hyderabad
superb post. Thanks for the blog.
ReplyDeleteJava course in Pune