Class LanguageManager

java.lang.Object
org.geysermc.floodgate.core.util.LanguageManager

@Singleton public final class LanguageManager extends Object
Manages translations for strings in Floodgate
  • Constructor Details

    • LanguageManager

      public LanguageManager()
  • Method Details

    • init

      @Inject public void init(FloodgateConfig config)
      Tries to load the log's locale file once a string has been requested
    • loadLocale

      public boolean loadLocale(String locale)
      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 translate
      locale - locale to translate to
      type - 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

      public String rawTranslation(String key, @Nullable String locale)
    • getDefaultLocale

      public String getDefaultLocale()
      The locale used in console and as a fallback