Class MinecraftLocale

java.lang.Object
org.geysermc.geyser.text.MinecraftLocale

public class MinecraftLocale extends Object
  • Field Details

  • Constructor Details

    • MinecraftLocale

      public MinecraftLocale()
  • Method Details

    • ensureEN_US

      public static void ensureEN_US()
    • downloadAndLoadLocale

      public static void downloadAndLoadLocale(String locale)
      Downloads a locale from Mojang if it's not already loaded
      Parameters:
      locale - Locale to download and load
    • parseLangFile

      public static Map<String,String> parseLangFile(Path localeFile, String locale)
      Load and parse a json lang file.
      Parameters:
      localeFile - Path of locale file
      locale - Locale to load
      Returns:
      a Map of the loaded translations
    • getLocaleString

      public static String getLocaleString(String messageText, String locale)
      Translate the given language string into the given locale, or falls back to the default locale
      Parameters:
      messageText - Language string to translate
      locale - Locale to translate to
      Returns:
      Translated string or the original message if it was not found in the given locale
    • getLocaleStringIfPresent

      public static @Nullable String getLocaleStringIfPresent(String messageText, String locale)
      Translate the given language string into the given locale, or returns null.
      Parameters:
      messageText - Language string to translate
      locale - Locale to translate to
      Returns:
      Translated string or null if it was not found in the given locale
    • isLocaleLoaded

      public static boolean isLocaleLoaded(String locale)
      Checks if a locale has been loaded.
      Parameters:
      locale - Locale to check
      Returns:
      true if the locale has been loaded