LocaleLib 1.5

Show translated names of items, entities & more in client's language

  1. PikaMug
    Native Minecraft Version:
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    Source Code:
    Languages Supported:
    All of them!

    From the author of Quests: A new library for developers! When imported, you will be able to send messages to players in which Minecraft will translate Material, EntityType, and Enchantment names into the target client's language. From Afrikaans and Albanian, to Welsh and Yoruba - tearing down the language barrier has never been easier!

    Compatible with Bukkit 1.7.2 and up!
    Getting Started

    To use the library, first add the LocaleLib jar to your Java build path or add it as a Maven dependency via Jitpack:
    Code (Text):
    Code (Text):
    Then, add LocaleLib as a dependency (or soft-dependency, if you can live without it) to your plugin.yml file:
    Code (YAML):
    depend: [LocaleLib]
    Next, you'll need a reference to LocaleManager. Just add the following in your onEnable() method:
    Code (Java):
    private LocaleManager localeManager;

    public void onEnable() {
       LocaleLib localeLib = (LocaleLib) getServer().getPluginManager().getPlugin("LocaleLib");
       localeManager = LocaleLib.getLocaleManager();
    Lastly, you'll want to decide which message command to use (but first, get your player - here's one way to do it):
    Code (Java):
    org.bukkit.entity.Player p = Bukkit.getPlayer("PikaMug");
    Translate Items

    To send the message "I make Dirt look good", do the following:
    Code (Java):
    localeManager.sendMessage(p, "I make "
            + ChatColor.GREEN + "<item>" + ChatColor.RESET
            + " look good", Material.DIRT, (short) 0, null);
    In English (US), this will appear as...


    ...but if the player is using Español (México), it will appear as...


    Let's say you want Podzod instead of Dirt. On Minecraft 1.13 or above, do this:
    Code (Java):
    if (localeManager.isBelow113()) {
        localeManager.sendMessage(p, "I make <item> look good", Material.DIRT, (short) 1, null);
    } else {
        localeManager.sendMessage(p, "I make <item> look good", Material.PODZOL, (short) 0, null);
    Note the durability value of '1' for older versions of Minecraft, rather than '0' for newer ones.

    For an item with enchantments, like "A Diamond Sword with Impaling V", try this:
    Code (Java):
    Map<Enchantment, Integer> ench = new LinkedHashMap<Enchantment, Integer>();
            ench.put(Enchantment.IMPALING, 5);
            localeManager.sendMessage(p, "A <item> with <enchantment> V", Material.DIAMOND_SWORD, (short) 0, ench);
    Note that levels do not automatically appear in the message at this time, but this may be added in a future release.

    Translate Enchantments

    To send the message "Enchant Silk Touch I and Luck III"
    Code (Java):
    Map<Enchantment, Integer> enchs = new LinkedHashMap<Enchantment, Integer>();
            enchs.put(Enchantment.SILK_TOUCH, 1);
            enchs.put(Enchantment.LUCK, 3);
            localeManager.sendMessage(p, "Enchant <enchantment> I and <enchantment> III", enchs);
    Note that levels do not automatically appear in the message at this time, but this may be added in a future release.

    Translate Mobs

    To send the message "Pig is best mob?"
    Code (Java):
    localeManager.sendMessage(p, "<mob> is best mob?", EntityType.PIG, null);
    Or, to send the message "The Killer Bunny strikes again!"
    Code (Java):
    localeManager.sendMessage(p, "<mob> strikes again!", EntityType.RABBIT, Rabbit.Type.THE_KILLER_BUNNY);

    [​IMG] [​IMG] [​IMG]
    FontaCraft, zuhir, Dr4cc and 2 others like this.

Recent Reviews

  1. InsanityFactions
    Version: 1.5
    This API is incredible, and genuinly so helpful. Good work very happy that I could find something like this, Thank you <3
  2. DrOreo002
    Version: 1.3
    Really useful api for my server! I'm sure I'm gonna use it now. Thanks man ;)

    10/10 ~ DrOreo002