1.14.4 Getting item name depending on lang/locale

Discussion in 'Spigot Plugin Development' started by xDec0de_, Jan 9, 2020.

  1. So... I made a plugin that adds a rarity sistem to items but I don't know how to modify their name depending on the lang I choose, in this case "es_ES", so "Dirt" will be "Tierra" (This will not depend on player's lang, it will always be spanish).

    Also, this is for 1.14.4, I have searched and found some language APIs but for 1.12 or less.
     
  2. ItemMeta#getLocalizedName() gets the localized name depending on the servers language settings.
     
    • Useful Useful x 2
    • Like Like x 1
  3. Oh... Thanks (I think I should take a better look to the API)

    Edit:

    meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&7"+meta.getLocalizedName()));

    [​IMG]

    Is this normal?
     
    #3 xDec0de_, Jan 9, 2020
    Last edited: Jan 9, 2020
  4. Bump? :c

    I really need this for my plugin to work.
     
  5. Inside your spigot jar, there is a lang yaml file. You need to open it, select everything and delete everything. Once that is done, you will need to find your client lang file in the language you want and open it with a text editor. Now select everything and copy/paste it to the lang server file. Save and restart the server. It should work and now your server is gonna be in full es_ES (if chosen)