Hello Friends Today, through this article I will tell you how you can convert English Text into Hindi Text through javascript. So let’s try to understand.
Converting English text into hindi by javascript, Typing English text into hindi using js, English text to Hindi text convert create online free tool using javascript
First of all, there are many such students, employers working in the company, or people working in a bank who also do not know how to type blog in Hindi. So all these users of Hindi typing converter tool With support, he writes blogs in Hindi.
Now we talk about how to create Hindi typing tool converter?
So friends, you can easily convert English text to Hindi text through javascript. The code of javascript is given to you by example below.
Overview
Step 1:- Create HTML File and Write Code(english-to-hindi-converter.html).
Step 2:- Create js file and write code then inclue file with html file(converter.js).
Step 1:- Create HTML File and Write Code(english-to-hindi-converter.html).
english-to-hindi-converter.html
<html>
<head>
<title>How to Convert Hindi Text into English Using JavaScript?</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="/converter.js"></script>
<link href="http://www.google.com/uds/modules/elements/transliteration/api.css"
type="text/css" rel="stylesheet"/>
</head>
<body>
<h1>How to Convert Hindi Text into English Using JavaScript?</h1><br>
<h2>Type in Hindi (Press Ctrl+g to toggle between English and Hindi)</h2>
<a href="#" onclick="document.getElementById('Wrapper').style.display = 'block'; return false;">show textarea</a>
<div id="Wrapper"> <h2> Textarea </h2>
<textarea id="transliterateTextarea" style="width:650px;height:300px"></textarea>
</div>
</body>
</html>
Step 2:- Create js file and write code then inclue file with html file(converter.js).
converter.js
// Load the Google Transliteration API
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
google.elements.transliteration.LanguageCode.HINDI,
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
var control =
new google.elements.transliteration.TransliterationControl(options);
control.makeTransliteratable(['transliterateTextarea']);
}
google.setOnLoadCallback(onLoad);
You can also write javascript code in html file. How to add js code to html file. You are given below.
english-to-hindi-converter.html
<html>
<head>
<title>How to Convert Hindi Text into English Using JavaScript?</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<link href="http://www.google.com/uds/modules/elements/transliteration/api.css"
type="text/css" rel="stylesheet"/>
</head>
<body>
<h1>How to Convert Hindi Text into English Using JavaScript?</h1><br>
<h2>Type in Hindi (Press Ctrl+g to toggle between English and Hindi)</h2>
<div id="Wrapper"> <h2> Textarea </h2>
<textarea id="transliterateTextarea" style="width:650px;height:300px"></textarea>
</div>
</body>
<script type="text/javascript">
// Load the Google Transliteration API
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
google.elements.transliteration.LanguageCode.HINDI,
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
var control =
new google.elements.transliteration.TransliterationControl(options);
control.makeTransliteratable(['transliterateTextarea']);
}
google.setOnLoadCallback(onLoad);
</script>
</html>