Class Language

java.lang.Object
org.purpurmc.purpur.language.Language

@NullMarked public abstract class Language extends Object
Represents a language that can translate translation keys
  • Constructor Details

    • Language

      public Language()
  • Method Details

    • getLanguage

      public static @Nullable Language getLanguage()
      Returns the default language of the server
    • setLanguage

      public static void setLanguage(Language language)
    • has

      public abstract boolean has(String key)
      Checks if a certain translation key is translatable with this language
      Parameters:
      key - The translation key
      Returns:
      Whether this language can translate the key
    • has

      public boolean has(Translatable key)
      Checks if a certain translation key is translatable with this language
      Parameters:
      key - The translation key
      Returns:
      Whether this language can translate the key
    • getOrDefault

      public abstract String getOrDefault(String key)
      Translates a translation key to this language
      Parameters:
      key - The translation key
      Returns:
      The translated key, or the translation key if it couldn't be translated
    • getOrDefault

      public String getOrDefault(Translatable key)
      Translates a translation key to this language
      Parameters:
      key - The translation key
      Returns:
      The translated key, or the translation key if it couldn't be translated