-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgoog.html
69 lines (60 loc) · 2.67 KB
/
goog.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google AJAX Search API Sample</title>
<script src="http://www.google.com/jsapi?key=AIzaSyA5m1Nc8ws2BbmPRwKu5gFradvD_hgq6G0" type="text/javascript"></script>
<script type="text/javascript">
/*
* How to setup a textarea that allows Transliteration from English to Arabic.
*/
// 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.ARABIC],
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};
// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);
// Create the HTML for our text area
var content = document.getElementById('content');
content.innerHTML = '<div id="ta3reebControl"> </div>'+
'<div>Type a word and hit space to get it in Arabic. ' +
'Click on a word to see more options.</div>' +
'<textarea cols="100" rows="5" id="ta3reebTextarea"></textarea>' +
'<div>Type in (do not copy/paste): ' +
'<b>mar7aban bekom fee ta3reeb</b></div>';
// Show the transliteration control which can be used to switch between
// English and Arabic.
control.showControl('ta3reebControl');
// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
control.makeTransliteratable(['ta3reebTextarea']);
var translit = function(wordsArray){
var srcLang, destLang, callback;
srcLang = google.elements.transliteration.LanguageCode.ENGLISH;
destLang = google.elements.transliteration.LanguageCode.ARABIC;
callback = function(obj){
console.log(obj); _obj = obj;
}
google.language.transliterate(wordsArray, srcLang, destLang, callback);
}
var wordsArray = ["iqra bismi rabbikallazi khalaq"], _obj;
translit(wordsArray);
}
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<A HREF='about/index.html'><strong>(about)</strong></A><BR/>
<div id="content">Loading...</div>
</body>
</html>
?