Class: Globalization

Globalization

A globalization object to set languages and retrieve strings.


new Globalization( [opt_options])

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

Options.

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

Extends

  • ol.Object

Methods


getByControl(control, property)

Obtains a translation for the given control and property. The translation is searched in bu.strings. The classnames of the main element in the control will be used to search using the pattern "classname#property". If a key is found with any classnames + property combination then that key is used.

Parameters:
Name Type Description
control bu.control.Control

The control.

property string

The property to be searched.

Source:
bu/globalization.js

getByKey(key)

Obtains a translation for the given key.

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

getLanguage()

Gets the language.

Source:
bu/globalization.js
Returns:

The current language.

Type
bu.Languages

getLanguageNames()

Returns the names of the main languages available.

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

getLanguages()

Returns the main languages available.

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

setLanguage(lang)

Sets the language.

Parameters:
Name Type Description
lang bu.Languages

The language.

Source:
bu/globalization.js

translateByControl(control, property, element [, attr])

Translates an HTML element attribute of a given control. The translation is searched in bu.strings. The classnames of the main element in the control will be used to search using the pattern "classname#property". If a key is found with any classnames + property combination then that key is used.

Parameters:
Name Type Argument Description
control bu.control.Control

The control.

property string

The property to search for.

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:
bu/globalization.js

translateByKey(key, element [, attr])

Translates an HTML element attribute of a given control. The translation is searched in bu.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:
bu/globalization.js