LangMan

open class LangMan<P : IMessageProvider<C>, C>

Manages language translations and message localization.

Parameters

P

The type of the message provider.

C

The type of the text component.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A mutable map that associates a Class type with a conversion function. The conversion function transforms an input of type Any into an Any object of the specified target class type.

Link copied to clipboard

Expected type of the message key for type safety.

Link copied to clipboard

Flag to enable debug mode.

Link copied to clipboard

A mutable map that holds localized messages organized by language codes and message keys.

Link copied to clipboard

A mutable map that manages replacement logic for specific types.

Link copied to clipboard
var t: InitType?

The initialization type used.

Link copied to clipboard

Factory function to create a text component.

Functions

Link copied to clipboard
fun getMessage(key: MessageKey<*, *>, vararg args: Any): String

Retrieves a system message using the default locale.

Link copied to clipboard
fun getMessageByLangCode(key: MessageKey<*, *>, lang: String, vararg args: Any): String

Retrieves a system message using a specific language code.

Link copied to clipboard
fun init(type: InitType, dir: File, langs: List<String>)

Initializes the language manager by loading translations from files.

Link copied to clipboard
inline fun <I : Any, C : Any> registerConversionLogic(noinline converter: (I) -> C)

Registers a conversion logic from type I to type C.

Link copied to clipboard
inline fun <I : Any> registerReplacementLogic(noinline logic: (I, String, I) -> I)