Class MycelTranslations

java.lang.Object
my.celium.org.translation.MycelTranslations

public final class MycelTranslations extends Object
Centralised translation helpers.

Keys are namespaced per mod: key("mymod", "config.enabled") gives "mymod.config.enabled". Mods ship their own en_us.json (and friends) under assets/<modid>/lang/ as usual; these helpers only remove key-building boilerplate and guarantee a missing translation can never crash the game - it falls back to readable text plus one debug line.

Remote translation downloading is intentionally not implemented: it would add network, cache-invalidation and trust concerns to a core library. If it ever lands, it will be optional, asynchronous, cached, timeout-controlled, validated and failure-tolerant.

  • Method Details

    • key

      public static String key(String modId, String path)
      Builds "<modId>.<path>" translation keys.
    • component

      public static net.minecraft.network.chat.MutableComponent component(String modId, String path, Object... args)
      Component.translatable for a namespaced key.
    • componentOrFallback

      public static net.minecraft.network.chat.Component componentOrFallback(String modId, String path, String fallback, Object... args)
      Translatable component, or a literal fallback when the key is missing. Never throws: any failure (including headless environments without a loaded language) yields the fallback.
    • has

      public static boolean has(String fullKey)
      Whether the currently loaded language provides fullKey.