Class: Globalization

Mapspace.language. Globalization

A globalization object to set languages and retrieve strings.


new Globalization( [opt_options])

Parameters:
Name Type Argument Description
opt_options Mapspace.language.GlobalizationOptions <optional>

Options.

Source:
mapspace/globalization.js
Fires:
  • ol.Object.Event#event:change:language

Extends

  • ol.Object

Methods


getLanguage()

Gets the language.

Source:
mapspace/globalization.js
Returns:

The current language.

Type
Mapspace.Languages

getLanguageNames()

Returns the names of the main languages available.

Source:
mapspace/globalization.js
Returns:
Type
Array.<Mapspace.Languages>

getLanguages()

Returns the main languages available.

Source:
mapspace/globalization.js
Returns:
Type
Array.<Mapspace.Languages>

getTranslation(key)

Obtains a translation for the given key.

Parameters:
Name Type Description
key string
Source:
mapspace/globalization.js
Returns:
Type
Object

setLanguage(lang)

Sets the language.

Parameters:
Name Type Description
lang Mapspace.Languages

The language.

Source:
mapspace/globalization.js

translate(key, element [, attr])

Translates an HTML element attribute of a given control. The translation is searched in Mapspace.strings using the key provided.

Parameters:
Name Type Argument Description
key string

The key.

element HTMLElement

The HTML element to modify.

attr string <optional>

The optional attribute of the element to modify. If not provided then the inner HTML will be replaced.

Source:
mapspace/globalization.js