Global

Methods

<private> _bindEvents()

Binds events to the localization tool widget.
Source:

<private> _buildStringReferenceMapping()

Goes through each text node and builds a string reference mapping. It is a mapping (an object) STRING_IDENTIFIER -> used later for the translation. See init method for a reference. The resulting object is stored internally in $this.data('refMappingObj') as refMapping.
Source:

<private> _decomposeStringsForReferenceMapping() → {object}

Analizes the input strings object and decomposes its keys in sections: text strings, id strings, class strings, element strings, attribute strings.
Source:
Returns:
the decomposition object.
Type
object

<private> _findSubsetOfUsedLanguages(stringsObj) → {array}

Goes through each string defined and extracts the common subset of languages that actually used. The default language is added to this subset a priori. The resulting list is sorted by country name.
Parameters:
Name Type Description
stringsObj object the strings to translate
Source:
Returns:
usedLanguageCodes - an array of country codes sorted based on country names.
Type
array

<private> _initializeWidget(languageCodeArray)

Initializes the localization tool widget.
Parameters:
Name Type Description
languageCodeArray array the language code array of the languages to be displayed
Source:

_languageCodeToHtml(languageCode)

Returns the html representation for the given language code.
Parameters:
Name Type Description
languageCode string the language code as defined in the settings object
Source:

<private> _languageCodeToOrdinal(lanuageCode) → {number}

Returns the ordinal number corresponding to the given language code, or throws in case the given language code is not defined. NOTE: this method operates on the active languages, therefore $this.data('activeLanguageCodeArray') must be available when the method is called.
Parameters:
Name Type Description
lanuageCode string the language code to convert to ordinal
Source:
Returns:
ordinal - the converted ordinal
Type
number

<private> _mayTranslate(languageCode)

Calls the user specified callback (if any), then translates the page. If the user returned 'false' in his/her callback, the translation is not performed.
Parameters:
Name Type Argument Description
languageCode string <optional>
the language code to translate to
Source:

<private> _onDropdownClicked()

Handles dropdown click event.
Source:

<private> _onKeydown(e)

Handles keydown event
Parameters:
Name Type Description
e event the keydown event
Source:

<private> _onLanguageSelected($item)

Handles user clicks on a certain dropdown item.
Parameters:
Name Type Description
$item $element the jquery item clicked
Source:

<private> _onMouseout()

Handles mouseout on dropdown items.
Source:

<private> _ordinalToLanguageCode(ordinal) → {string}

Returns the language code corresponding to the given ordinal number. It throws in case the given ordinal number does not correspond to any language code. NOTE: this method operates on the active languages, therefore $this.data('activeLanguageCodeArray') must be available when the method is called.
Parameters:
Name Type Description
ordinal number the ordinal number to convert into a language code
Source:
Returns:
languageCode - the converted language code
Type
string

<private> _selectLanguage(languageCode)

Displays the given language in the dropdown menu.
Parameters:
Name Type Description
languageCode string the language code
Source:

<private> _selectPreviousLanguage()

Select the language before the current language in the list.
Source:

<private> _selectPreviousLanguage()

Select the language after the current language in the list.
Source:

<private> _sortCountryLanguagesByCountryName(languagesDefinition, arrayOfCountryLanguageCodes) → {array}

Sorts the given array of countryLanguageCodes by country name. If a language has no name goes to the bottom of the list.
Parameters:
Name Type Description
languagesDefinition object the array countryLanguageCodes defined during initialization.
arrayOfCountryLanguageCodes array the input array countryLanguageCodes.
Source:
Returns:
sortedArrayOfCountryLanguageCodes - the sorted array countryLanguageCodes.
Type
array

destroy()

Destroys the dropdown widget.
Source:

getSelectedLanguageCode() → {string}

Returns the code of the language currently selected
Source:
Returns:
[languageCode] - the language code currently selected
Type
string

init(options)

Initialises the localization tool plugin.
Parameters:
Name Type Argument Description
options object <optional>
the user options
Source:
Returns:
jqueryObject

translate(languageCode)

Translates the current page.
Parameters:
Name Type Argument Description
languageCode string <optional>
the language to translate to.
Source: