LanguageManager

class LanguageManager(plugin: JavaPlugin? = null, logger: Logger, selectedLanguage: Language, resourceLoader: (String) -> InputStream?? = null)(source)

Manages language files and provides message retrieval with string-based keys.

This class handles:

  • Loading language files from resources/languages/

  • Caching flattened language messages in memory

  • Providing message retrieval with placeholder substitution

  • Fallback to English if the selected language is unavailable

Constructors

Link copied to clipboard
constructor(plugin: JavaPlugin? = null, logger: Logger, selectedLanguage: Language, resourceLoader: (String) -> InputStream?? = null)

Functions

Link copied to clipboard
fun getMessage(key: String, placeholders: Map<String, String> = emptyMap()): String

Retrieves a message for the given string key with optional placeholder substitution. If the selected language is unavailable, falls back to English.

Link copied to clipboard

Gets the translated text for a toggle state (enabled/disabled).

Link copied to clipboard

Initializes the language manager by loading all language files. This should be called during plugin initialization.