How to Convert English Text Into Hindi Using javascript?

1 comment

Sometimes we need to develop a website with Hindi font. But main problem is how to insert content in Hindi in admin panel. so here is a solution –

In this tutorial you are going to learn how to  convert  your english text into hindi .

Just type the text in english in the given box and press space, it will convert the text in hindi .

Here is just a simple javascript .

<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">

// Load the Google Transliterate 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
};

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

// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
control.makeTransliteratable(['transliterateTextarea']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
Type in Hindi (Press Ctrl+g to toggle between English and Hindi)<br>
<textarea id="transliterateTextarea" style="width:600px;height:200px"></textarea>
</body>

Live Demo
Download Demo

One Comment

  1. hello sir!aap ka artical padha, it very nice. mene bhi one month pahle blog wrinitg start ki h.. or me hindi me likhna chahti thi pe hindi blog ke liye typing method nahi pata tha..aap ne jo hindi typing blog hum sab ko provide kiya ha us ke liye thanks..

    Reply

Leave A Comment

Loading...