Class Language

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

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

    • Language

      public Language()
  • Method Details

    • getLanguage

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

      public static void setLanguage(@NotNull @NotNull Language language)
    • has

      public abstract boolean has(@NotNull @NotNull 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(@NotNull @NotNull net.kyori.adventure.translation.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

      @NotNull public abstract @NotNull String getOrDefault(@NotNull @NotNull 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

      @NotNull public @NotNull String getOrDefault(@NotNull @NotNull net.kyori.adventure.translation.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