interfaces language - wxyz-abcd/node-haxball GitHub Wiki
All properties and methods about global language handling reside in this object.
(Look inside examples/languages/englishLanguage.js for the default language function and example usage.)
-
current: string
: This is the abbreviation of the current language. Defaults to'GB'
. It is possible to change the language of the whole API by changing this value directly; throws error if the language does not exist. -
currentData: object
: (read-only) Contains all name mappings for the current language, namelyerrorsTextMap
,connectionStateTextMap
andrendererTextMap
that are already described in section 2.1. -
indices: object
: (read-only) Contains the global name-to-integer mappings that shortly describe the language string. This object has the following keys:-
ErrorCodes: object
: Name-to-integer mapping that shortly describes the error codes used inHBError
class. Note that this is the same object asErrors.ErrorCodes
. -
ConnectionState: object
: Name-to-integer mapping that shortly describes the connection states encountered while joining a room. Note that this is the same object as the API's globalConnectionState
object. -
RendererTextIndices: object
: Name-to-integer mapping that shortly describes the default renderer's language text indices used inside the current default renderers.
-
-
add(abbr: string, errorsTextMap: object, connectionStateTextMap: object, rendererTextMap: object): void
Adds a new language with given properties. Throws an error while trying to add an already-existing language.
Parameters:
-
abbr
: The language abbreviation value. Must be unique. This value is automatically transformed into upper-case. -
errorsTextMap
: An object that has a description function for each error code where each function returns a string. -
connectionStateTextMap
: An object that maps eachconnectionState
number to astring
value. -
rendererTextMap
: An object that maps eachrendererTextIndex
number to astring
value.
Return value: void.
-
-
remove(abbr: string): void
Removes the language that has the given abbreviation value(
abbr
). Throws error while trying to remove a non-existent or current language.Parameters:
-
abbr
: The language abbreviation value. This value is automatically transformed into upper-case.
Return value: void.
-