new Lang(languages)
Class for language translation using the Google Translate Gadget
Parameters:
Name | Type | Description |
---|---|---|
languages |
nyc.Lang.Choices | The languages to provide |
Properties:
Name | Type | Description |
---|---|---|
target |
String | Element | JQuery | The HTML DOM element that will provide language choices |
Members
(static) EventType :string
Enumeration for nyc.Lang event types
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
READY |
string | The ready event type |
CHANGE |
string | The change event type |
Methods
init()
Initializes the class on callback from the Google Translate Gadget loader
lang() → {string}
Get the currently chosen language code
Returns:
The currently chosen language code
- Type
- string
Type Definitions
Choice
A language choice for nyc.Lang.Choices
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
val |
string | The language value used by Google | |
desc |
string | The display value for the language | |
hint |
string |
<optional> |
The translation of the word 'Translate' in the language |
Choices
A mapping of nyc.Lang.Choice objects to language codes
Type:
- Object.<string, nyc.Lang.Choice>
Example
{
en: {val: 'English', desc: 'English', hint: 'Translate'},
es: {val: 'Spanish', desc: 'Español', hint: 'Traducir'}
}
Events
change
The language value has changed
Type:
- string
ready
The class has completed initialization
Type:
- boolean