Insane96MCP Posted October 20, 2017 Posted October 20, 2017 (edited) I would like to have item information with addInformation() but have it localized. I've tried with tooltip.add(ChatFormatting.DARK_PURPLE + "descr.bonus.hoe"); but is not working Edited October 20, 2017 by Insane96MCP Quote
Kokkie Posted October 20, 2017 Posted October 20, 2017 That's because you have 3 minutes ago, Insane96MCP said: ChatFormatting.DARK_PURPLE Which requires you to the color code in your lang file, remove it. To make it have colors you put § + a number in front of the 'translation'. Quote Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
Draco18s Posted October 20, 2017 Posted October 20, 2017 Either use a TextComponentTranslation or translate using I18n. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Draco18s Posted October 20, 2017 Posted October 20, 2017 1 minute ago, Kokkie said: That's because you have Which requires you to the color code in your lang file, remove it. To make it have colors you put § + a number in front of the 'translation'. Wrong. Tooltip entries are not translated when displayed, you have to do it yourself. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Kokkie Posted October 20, 2017 Posted October 20, 2017 Just now, Draco18s said: Wrong. Tooltip entries are not translated when displayed, you have to do it yourself. But still, if he would pass it as a string to translate he would have to remove that, or make them seperate Quote Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
Draco18s Posted October 20, 2017 Posted October 20, 2017 (edited) 2 minutes ago, Kokkie said: But still, if he would pass it as a string to translate he would have to remove that, or make them seperate No. tooltip.add(TextFormatting.LIGHT_PURPLE + I18n.format("tooltip:oreflowers:indicator")); Edited October 20, 2017 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Kokkie Posted October 20, 2017 Posted October 20, 2017 Just now, Draco18s said: No. tooltip.add(TextFormatting.LIGHT_PURPLE + I18n.format("tooltip:oreflowers:april.one")); That's what I ment with 2 minutes ago, Kokkie said: or make them seperate Quote Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
Draco18s Posted October 20, 2017 Posted October 20, 2017 1 minute ago, Kokkie said: That's what I ment with Quote or make them seperate Oh no, the horror of having to use a + and concatenate a string! Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Insane96MCP Posted November 1, 2017 Author Posted November 1, 2017 (edited) Double post. Deleted Edited November 1, 2017 by Insane96MCP Deleted Quote
Insane96MCP Posted November 1, 2017 Author Posted November 1, 2017 (edited) On 20/10/2017 at 8:46 PM, Draco18s said: No. tooltip.add(TextFormatting.LIGHT_PURPLE + I18n.format("tooltip:oreflowers:indicator")); Thanks everyone. I18n did the job. Another small question. How can I add a space after a string in the lang file? Like tooltip.item.base_info=This is an OP sword <-Space Seems like minecraft doesn't recognize the space. Nevermind. I'm stupid. ^ The same question goes for a space after the equal (=) tooltip.item.base_info= This is an OP sword In this case, minecraft doesn't recognize the string at all. I had to do tooltip.add(I18n.format("tooltip.item.base_info") + " "); and tooltip.add(" " + I18n.format("tooltip.item.base_info")); but I don't think that is a neat solution Edited November 1, 2017 by Insane96MCP I'm blind Quote
Insane96MCP Posted November 1, 2017 Author Posted November 1, 2017 31 minutes ago, diesieben07 said: You should't need to have spaces at the beginning of your translation. Do not ever add translations together in code, always do it via the language file with placeholders. Oh, forgot about placeholders. Quote
Insane96MCP Posted November 1, 2017 Author Posted November 1, 2017 35 minutes ago, diesieben07 said: You should't need to have spaces at the beginning of your translation. Do not ever add translations together in code, always do it via the language file with placeholders. There's any convention I should use for placeholders? Quote
Insane96MCP Posted November 1, 2017 Author Posted November 1, 2017 9 minutes ago, diesieben07 said: Not sure what you mean. Nevermind. Found out that I can use %d / %s / ... and the parameters parameter in I18n.format() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.