6ae7b60962
This is available only on the masthead search box in the OPAC. User has to enter a word in english and press space or return to transliterate the word. The destination language can be selected from a drop down list. User can temporarily turn on/off the feature by using "ctrl +g". A system preference - GoogleIndicTransliteration can be used to turn on this feature. Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
29 lines
959 B
JavaScript
29 lines
959 B
JavaScript
// Load the Google Transliteration API
|
|
google.load("elements", "1", {
|
|
packages: "transliteration"
|
|
});
|
|
|
|
function onLoad() {
|
|
var options = {
|
|
sourceLanguage: 'en',
|
|
destinationLanguage: ['hi','kn','ml','ta','te'],
|
|
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 textfields with the given ids.
|
|
var ids = [ "transl1" ];
|
|
control.makeTransliteratable(ids);
|
|
|
|
// Show the transliteration control which can be used to toggle between
|
|
// English and Hindi and also choose other destination language.
|
|
control.showControl('translControl');
|
|
}
|
|
google.setOnLoadCallback(onLoad);
|
|
|
|
|