it/itf/static/js/jquery.transliterate.js
2011-10-08 03:03:05 -04:00

27 lines
745 B
JavaScript
Executable File

/*
Use like $(elem).GTransliterate(lang);
where lang = a language code like "hi", "ka", etc.
Make sure to include <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> at top of page
Also, you must include this at the top of your page:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
*/
google.load("elements", "1", {
packages: 'transliteration'
});
jQuery.fn.GTransliterate = function(lang) {
var options = {
sourceLanguage: 'en',
destinationLanguage: [lang],
transliterationEnabled: true
}
var thisId = this.attr('id');
var GControl = new google.elements.transliteration.TransliterationControl(options);
GControl.makeTransliteratable([thisId]);
return this;
}