Class: Lang maps.nyc.gov

nyc.Lang

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
Source:

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
Source:

Methods

init()

Initializes the class on callback from the Google Translate Gadget loader
Source:

lang() → {string}

Get the currently chosen language code
Source:
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
Source:

Choices

A mapping of nyc.Lang.Choice objects to language codes
Type:
Source:
Example
{
	en: {val: 'English', desc: 'English', hint: 'Translate'},
	es: {val: 'Spanish', desc: 'Espa&#241;ol', hint: 'Traducir'}
}

Events

change

The language value has changed
Type:
  • string
Source:

ready

The class has completed initialization
Type:
  • boolean
Source: