new Translate(options)
Class for language translation using the Google Translate Gadget
Parameters:
| Name | Type | Description |
|---|---|---|
options |
module:nyc/lang/Translate~Translate.Options | Constructor options |
- Source:
Fires:
Extends
- module:nyc/lang/Container~Container
Members
-
<static, constant> DEFAULT_LANGUAGES :module:nyc/lang/Translate~Translate.Choices
-
Default languages for NYC
Type:
- Source:
Methods
-
<protected> getCookieValue()
-
Gets a cookie value
- Source:
Returns:
- Type
- string
-
lang()
-
Get the currently chosen language code
- Source:
Returns:
The currently chosen language code
- Type
- string
-
translate(event)
-
Sets the chosen language and performs message substitution
Parameters:
Name Type Description eventjQuery.Event - Source:
Type Definitions
-
Choice
-
A language choice for module:nyc/lang/Translate~Translate.Choices
Type:
- Object
- Source:
Properties:
Name Type Argument Description codestring The language code
namestring The language name
nativestring The display value for the language
hintstring <optional>
The translation of the word 'Translate' in the language
-
Choices
-
A mapping of Translate.Choice objects to language codes
Type:
- Object.<string, module:nyc/lang/Translate~Translate.Choice>
- Source:
-
Options
-
Constructor options for module:nyc/lang/Translate~Translate
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description targetString | Element | JQuery The HTML DOM element that will provide language choices
languagesTranslate.Choices The languages to provide
messagesObject.<string, Object.<string, string>> The language-specific message bundles
defaultLanguagestring <optional>
'en' The default language
buttonboolean <optional>
false Show as a button
Events
-
change
-
The language value has changed
Type: string
- Source:
-
ready
-
The class has completed initialization
Type: boolean
- Source: