Skip to content

LanguageSelector Widget v7

kecerit edited this page Nov 15, 2021 · 4 revisions
  • status : complete
  • version : 7.x

Illustration

Illustration of the LanguageSelector widget

Appearance of the LanguageSelector widget when two languages are available.

Introduction

The language selector widget allows to select the language for a game from a list of available languages retrieved from the server.

The result of the selection are saved in node.player.lang. The language object contains at least the following properties:

  • name: Name of the language in English.
  • nativeName: Native name of the language.
  • shortName: An abbreviation for the language, e.g. de, it, es, etc.

Main Options

  • usingButtons: if TRUE, the interface displays buttons, otherwise a drop-down selector is used. Default: TRUE.

Main Methods

  • setLanguage: Sets the chosen language in the widget and also calls node.setLanguage, which in turn emits 'LANGUAGE_SET' if selection is valid.

Listeners

in.say.LANG: updates the list of available languages.

Usecase

// Creates and append a new MoneyTalks widget.
var root = document.body;
var langSelector = node.widgets.append('LanguageSelector', root);

Links

Clone this wiki locally