Package org.geysermc.floodgate.core.util
Class LanguageManager
java.lang.Object
org.geysermc.floodgate.core.util.LanguageManager
Manages translations for strings in Floodgate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe locale used in console and as a fallbacknet.kyori.adventure.text.ComponentgetString(String key, @Nullable String locale, MessageType type, Placeholder... placeholders) Get a formatted language string with the given locale for Floodgatevoidinit(FloodgateConfig config) Tries to load the log's locale file once a string has been requestedbooleanloadLocale(String locale) Loads a Floodgate locale from resources; if the file doesn't exist it just logs a warningrawTranslation(String key, @Nullable String locale)
-
Constructor Details
-
LanguageManager
public LanguageManager()
-
-
Method Details
-
init
Tries to load the log's locale file once a string has been requested -
loadLocale
Loads a Floodgate locale from resources; if the file doesn't exist it just logs a warning- Parameters:
locale- locale to load- Returns:
- true if the locale has been found
-
getString
public net.kyori.adventure.text.Component getString(String key, @Nullable String locale, MessageType type, Placeholder... placeholders) Get a formatted language string with the given locale for Floodgate- Parameters:
key- language string to translatelocale- locale to translate totype- determines the scale of the message (and its arguments)placeholders- values to put into the string- Returns:
- translated string or "key arg1, arg2 (etc.)" if it was not found in the given locale
-
rawTranslation
-
getDefaultLocale
The locale used in console and as a fallback
-