Instances of google.elements.transliteration.TransliterationControl are designed to enable transliteration on a set of textfields in your webpage.
| Constructor | Description |
|---|---|
|
|
Creates a new
|
| Method | Return Type | Description |
|---|---|---|
|
|
None |
Makes textfields as transliteratable and allows whatever is typed in these to be transliterated.
|
|
|
None |
Shows the control in the
|
| Method | Return Type | Description |
|---|---|---|
|
|
None |
Turns on transliteration. |
|
|
None |
Turns off transliteration. |
|
|
None |
Toggles transliteration on or off status. |
|
|
Boolean |
Changes the language pair for transliteration.
Returns a boolean indicating whether the setLanguage action was successful. Throws exception under the following cases: sourceLanguage or destinationLanguage is invalid, the souceLangauge-destinationLanguage language pair is not supported |
|
|
Object with fields sourceLanguage and destinationLanguage |
Gets the current language pair for transliteration. Returns an object that contains the fields sourceLanguage & destinationLanguage. |
|
|
Boolean |
Returns a boolean indicating whether transliteration is enabled or not. |
|
|
None |
Adds a listener for the given event type. When the particular event type is triggered, the listener is called with the event object. The contents of the event object depend on the type of the event and the EventTypes are described in more detail here.
|
|
|
None |
Removes a listener.
|
| Method | Return Type | Description |
|---|---|---|
google.elements.transliteration.isBrowserCompatible |
Boolean |
Returns a boolean indicating whether transliteration is supported in the client's browser. |
google.elements.transliteration.getDestinationLanguages(sourceLanguage) |
Map of supported destination languages with key as language name and value as language code |
For the given sourceLanguage, this returns a map of destination languages for which transliteration is supported. The returned map is similar to the one described in the LanguageCode section.
|
google.language.transliterate is a low level API which can be invoked after loading the AJAX Language API as explained in the Developer Guide
| Method | Return Type | Description |
|---|---|---|
google.language.transliterate(wordsArray, srcLang, destLang, callback) |
None |
A global method that will obtain transliterations for the given words in the destination language. The result is supplied asynchronously to the given callback function as the result object.
|
This result object is obtained when the google.language.transliterate() call is invoked.
error?codemessagetransliterationswordsArray.transliteratedWordswordsArray.The google.elements.transliteration.TransliterationControl.EventType enumeration provides possible events which can be raised during transliteration. Developers can provide custom handlers for these events in their code.
var google.elements.transliteration.TransliterationControl.EventType = {
STATE_CHANGED: 'state_changed',
LANGUAGE_CHANGED: 'language_changed',
SERVER_REACHABLE:'server_reachable',
SERVER_UNREACHABLE:'server_unreachable'
};
The google.elements.transliteration.LanguageCode enumeration provides a mapping from name constants to language codes that can be used to specify the source and destination languages in the transliteration methods.
var google.elements.transliteration.LanguageCode = {
ENGLISH: 'en',
ARABIC: 'ar',
BENGALI: 'bn',
GUJARATI: 'gu',
HINDI: 'hi',
KANNADA: 'kn',
MALAYALAM: 'ml',
MARATHI: 'mr',
NEPALI: 'ne',
PERSIAN: 'fa',
PUNJABI: 'pa',
TAMIL: 'ta',
TELUGU: 'te',
URDU: 'ur'
};
The google.elements.transliteration.SupportedDestinationLanguages enumeration provides a mapping from name constants to arrays of language codes that can be used to specify groups of destination languages in the TransliterationControl.
var google.elements.transliteration.SupportedDestinationLanguages = {
// ALL includes all languages supported in the transliteration API.
// As support for more languages becomes available, this enum will be
// automatically updated to include the new languages transparently.
ALL: [
google.elements.transliteration.LanguageCode.ARABIC,
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.GUJARATI,
google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.KANNADA,
google.elements.transliteration.LanguageCode.MALAYALAM,
google.elements.transliteration.LanguageCode.MARATHI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.PERSIAN,
google.elements.transliteration.LanguageCode.PUNJABI,
google.elements.transliteration.LanguageCode.TAMIL,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.URDU],
// INDIC includes all Indic languages supported in the transliteration API.
// As support for more Indic languages becomes available, this enum will be
// automatically updated to include the new languages transparently.
INDIC: [
google.elements.transliteration.LanguageCode.BENGALI,
google.elements.transliteration.LanguageCode.GUJARATI,
google.elements.transliteration.LanguageCode.HINDI,
google.elements.transliteration.LanguageCode.KANNADA,
google.elements.transliteration.LanguageCode.MALAYALAM,
google.elements.transliteration.LanguageCode.MARATHI,
google.elements.transliteration.LanguageCode.NEPALI,
google.elements.transliteration.LanguageCode.PUNJABI,
google.elements.transliteration.LanguageCode.TAMIL,
google.elements.transliteration.LanguageCode.TELUGU,
google.elements.transliteration.LanguageCode.URDU]
};