Convert English Words to Hindi Words
Some time you have make a code that will convert the English
words to Hindi words. This is called
transliteration as you seen in many news
paper web sites. They provide a form to send comments in Hindi or English. Listed
below the code that will transliterate English word to Hindi words.
I have used Google transliteration.
<!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" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://www.google.com/jsapi"> </script>
<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
};
// 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(['firstName']);
control.makeTransliteratable(['lastName']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
<input type="text" autocomplete="OFF" class="tb4" id="firstName" name="firstName">
<input type="text" autocomplete="OFF" class="tb4" id="lastName" name="lastName">
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://www.google.com/jsapi"> </script>
<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
};
// 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(['firstName']);
control.makeTransliteratable(['lastName']);
}
google.setOnLoadCallback(onLoad);
</script>
</head>
<body>
<input type="text" autocomplete="OFF" class="tb4" id="firstName" name="firstName">
<input type="text" autocomplete="OFF" class="tb4" id="lastName" name="lastName">
</body>
</html>
0 comments:
Post a Comment