Class: Language

Language

Base class for all Klasa Languages. See Creating Languages for more information how to use this class to build custom languages.

new Language(client, dir, file [, options])

Parameters:
Name Type Argument Default Description
client KlasaClient The Klasa Client
dir string The path to the core or user language pieces folder
file Array The path from the pieces folder to the finalizer file
options LanguageOptions <optional>
{} Optional Language settings
Since:
  • 0.2.1
Implements:
Source:
lib/structures/Language.js#L25
Tutorials:

Properties


client :KlasaClient

Type:
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L30

dir :string

The directory to where this language piece is stored
Type:
  • string
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L37

enabled :boolean

If the language is enabled or not
Type:
  • boolean
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L65

file :string

The file location where this language is stored
Type:
  • string
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L44

name :string

The name of the language
Type:
  • string
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L51

type :string

The type of Klasa piece this is
Type:
  • string
Since:
  • 0.3.0
Source:
lib/structures/Language.js#L58

Methods


disable()

Disables this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L43
Returns:
This piece
Type
Piece

enable()

Enables this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L54
Returns:
This piece
Type
Piece

get(term, args)

The method to get language strings
Parameters:
Name Type Argument Description
term string The string or function to look up
args any <repeatable>
Any arguments to pass to the lookup
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L75
Returns:
Type
string | function

<async, abstract> init()

The init method to be optionaly overwritten in actual languages
Since:
  • 0.2.1
Source:
lib/structures/Language.js#L97
Returns:
Type
void

<async> reload()

Reloads this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L21
Returns:
The newly loaded piece
Type
Piece

unload()

Unloads this piece
Since:
  • 0.0.1
Implements:
Source:
lib/structures/interfaces/Piece.js#L33
Returns:
Type
void

Type Definitions


LanguageOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
name string <optional>
theFileName The name of the language
enabled boolean <optional>
true Whether the language is enabled or not
Source:
lib/structures/Language.js#L11