Sunday, 1 November 2015
TRANSLATE IN JAVA SCRIPT
--------------------------------------------------------------------------------------------------------------------------
ENGLISH TO HINDI CODE
--------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("elements", "1", {packages: "transliteration"});
</script>
<script>
function OnLoad() {
var currValue = document.getElementById("text1");
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(["text1"]);
var postValue = document.getElementById("text1");
}
google.setOnLoadCallback(OnLoad);
</script>
<form name="trans">
<input type="text" id="text1" name="text1" />
<br /><br />
<input type="text" id="text1" name="text2" />
</form>
--------------------------------------------------------------------------------------------------------------------------
ENGLISH TO URDU CODE
JUST LANGUAGE CHANGE
--------------------------------------------------------------------------------------------------------------------------
<html>
<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.URDU],
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>
</html>
--------------------------------------------------------------------------------------------------------------------------
OTHER EXAMPLES:
FIND THIS WOD IN GOOGLE:
english word change into hindi word java script
https://developers.google.com/transliterate/v1/getting_started?hl=en
http://www.coderanch.com/t/516146/HTML-CSS-JavaScript/translate-English-Hindi
--------------------------------------------------------------------------------------------------------------------------
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment