mooball
    Preparing search index...

    Class Language

    Index

    Constructors

    Properties

    Methods

    Constructors

    • Creates a new Language instance.

      Parameters

      • abbr: string

        Abbreviation of the new Language.

      • Optionalmetadata: any

        Any information that we would want to show/update inside a GUI application about this Library. This is not used by the API by default, but we can reprogram the Library's prototype to make use of this value if we want.

      Returns Language

      void.

    Properties

    current: Language | null

    This is the global current language instance. You can change this value directly. Defaults to null.

    abbr: string

    The abbreviation of this Language.

    api: { errors: NumberToTemplateStringMap }

    The main data object that has all of the Language data of this API.

    Type Declaration

    • errors: NumberToTemplateStringMap

      The language data for the errors of this API. Must map all error codes to template strings.

    Methods

    • Converts a template string to a normal string using the given parameters in arr. template string may include placeholders to represent the parameters. ("$1" for first parameter, "$2" for second parameter, and so on.) template string may also include the ? operator for simple conditioning. You may look at the language files for examples.

      Parameters

      • s: string

        The template string to convert

      • arr: any[]

        Parameters to replace the placeholders in the template string.

      Returns string | null

      A finalized version of the template string that has all the placeholders replaced by the parameters, or null if something went wrong.

    • This function is called internally inside the constructor of all Addons by default. The function body is empty by default. This means that the metadata values are not stored in Addon objects by default, because they are not useful in a non-GUI node.js environment. If we want to make use of the metadata, we might override this behavior by overriding this method. Remember that this should be done after initializing the API and before initializing any Addons.

      Parameters

      • Optionalmetadata: any

        An object that holds some metadata values. This value might depend on what you want to do with this API. The examples in the GitHub repo are intended to be shown in a web application GUI that can be accessed by anyone. Therefore, they use the following structure for this object:

        • name: string: Name of the RoomConfig that will be displayed on the GUI.
        • version: number: The current version number of this RoomConfig.
        • author: string: The author of this RoomConfig.
        • description: string: A detailed description of this RoomConfig.
        • allowFlags: int: This value defines whether it is possible to use this Addon while hosting or joining (or both) a room. Renderers do not use this key.

      Returns void

      void.