Translation

data class Translation(val id: String, val defaultValue: String, val group: String = "common", val language: String = "en", val mainColor: String? = null, val colors: Array<String> = emptyArray(), val autoRegister: Boolean = true)

Representation of a translation.

Parameters

id

The id of the translation

defaultValue

The default value of the translation.

group

The group (folder) where to store this translation. Defaults to "common"

language

The language of the translation. (Default to "en")

mainColor

The main color of the translation. (Default to null)

colors

The colors to use in the translation replacing strings. Example (using color '&c'): 'test' should return '&ctest'. Default to an empty array.

autoRegister

If the translation should be automatically registered. (Default to true) It is recommended to disable if you're going to initialize the same translation multiple times (for example, inside a loop)

Constructors

Link copied to clipboard
constructor(id: String, defaultValue: String, group: String = "common", language: String = "en", mainColor: String? = null, colors: Array<String> = emptyArray(), autoRegister: Boolean = true)

Properties

Link copied to clipboard
val autoRegister: Boolean = true
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard
Link copied to clipboard
val mainColor: String? = null

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Checks if this Translation is equals to another Translation.

Link copied to clipboard
open override fun hashCode(): Int

Gets the hash code of this Translation.

Link copied to clipboard
open override fun toString(): String

Translates this Translation to the current language.

Link copied to clipboard
fun translate(language: String? = null, placeholders: Map<String, String> = emptyMap(), colorize: Boolean = true): String

Translates this Translation to the current language.