Package org.geysermc.geyser.text
Class MinecraftLocale
java.lang.Object
org.geysermc.geyser.text.MinecraftLocale
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddownloadAndLoadLocale(String locale)Downloads a locale from Mojang if its not already loadedstatic voidstatic StringgetLocaleString(String messageText, String locale)Translate the given language string into the given locale, or falls back to the default localestatic StringgetLocaleStringIfPresent(String messageText, String locale)Translate the given language string into the given locale, or returns null.
-
Field Details
-
LOCALE_MAPPINGS
-
-
Constructor Details
-
MinecraftLocale
public MinecraftLocale()
-
-
Method Details
-
ensureEN_US
public static void ensureEN_US() -
downloadAndLoadLocale
Downloads a locale from Mojang if its not already loaded- Parameters:
locale- Locale to download and load
-
getLocaleString
Translate the given language string into the given locale, or falls back to the default locale- Parameters:
messageText- Language string to translatelocale- Locale to translate to- Returns:
- Translated string or the original message if it was not found in the given locale
-
getLocaleStringIfPresent
Translate the given language string into the given locale, or returns null.- Parameters:
messageText- Language string to translatelocale- Locale to translate to- Returns:
- Translated string or null if it was not found in the given locale
-