Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Language

Base class for all Klasa Languages. See {@tutorial CreatingLanguages} for more information how to use this class to build custom languages.

tutorial

CreatingLanguages

Hierarchy

Index

Constructors

constructor

  • new Language(store: Store<Piece>, directory: string, file: keyof string[], options?: PieceOptions): Language
  • since

    0.0.1

    Parameters

    • store: Store<Piece>

      The store this piece is for

    • directory: string

      The base directory to the pieces folder

    • file: keyof string[]

      The path from the pieces folder to the piece file

    • Optional options: PieceOptions

      The options for this piece

    Returns Language

Properties

Readonly client

client: Client

The client this Piece was created with.

since

0.0.1

Readonly directory

directory: string

The base directory this Piece is stored in.

since

0.0.1

enabled

enabled: boolean

Whether or not the Piece is enabled.

since

0.0.1

Readonly file

file: keyof string[]

The file location where this Piece is stored.

since

0.0.1

Abstract language

language: Record<string, LanguageValue> & { DEFAULT: (term: string) => string }

name

name: string

The name of the Piece.

since

0.0.1

Readonly store

The store this Piece is from.

since

0.0.1

Accessors

path

  • get path(): string
  • The absolute path to this piece

    since

    0.0.1

    Returns string

type

  • get type(): string
  • The type of piece this is

    since

    0.0.1

    Returns string

Methods

disable

  • disable(): this
  • Disables this piece

    since

    0.0.1

    chainable

    Returns this

enable

  • enable(): this
  • Enables this piece

    since

    0.0.1

    chainable

    Returns this

get

  • get(term: string, ...args: keyof unknown[]): string
  • The method to get language strings

    since

    0.2.1

    Parameters

    • term: string

      The string or function to look up

    • Rest ...args: keyof unknown[]

      Any arguments to pass to the lookup

    Returns string

init

  • init(): Promise<void>

reload

  • reload(): Promise<Piece | null>
  • Reloads this piece

    since

    0.0.1

    Returns Promise<Piece | null>

    The newly loaded piece

toJSON

  • toJSON(): Record<string, unknown>
  • Defines the JSON.stringify behavior of this piece.

    Returns Record<string, unknown>

toString

  • toString(): string
  • Defines toString behavior for pieces

    since

    0.0.1

    Returns string

    This piece name

unload

  • unload(): boolean
  • Unloads this piece

    since

    0.0.1

    Returns boolean

Generated using TypeDoc