Posted May 29, 20196 yr How can I get a translation in 1.13.2? In 1.12 there was implemented a I18n.translateToLocal method but in 1.13.2 seems that it does not exists.
May 29, 20196 yr 15 minutes ago, cinsiian said: In 1.12 there was implemented a I18n.translateToLocal method that method(or rather that entire class) was depricated since 1.7. It was implemented with net.minecraft.client.resources.I18n.format. Which didn't go anywhere.
June 1, 20196 yr Author What are the "parameters" of the format method I18n.format(stringKey, parameters)?
June 1, 20196 yr It would be the same as String::format. The first parameter is the format, while the rest are values to include in the format. In the case of I18n, the first parameter is the translation key, while the rest are values to fill in the matching translation value of the translation key. For example, if your eu_us.json has: "my_translation_key": "An integer: %d; a string: %s" , then I18n.format("my_translation_key", 10, "hello"); would return "An integer: 10; a string: hello" Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
June 1, 20196 yr Author Can you make an example just getting a string from the .json file? Putting "hello" it will return the word "hello" in-game but if I change the game's language, it will return "hello" again, right? So it's not a "translation" Edited June 1, 20196 yr by cinsiian
June 1, 20196 yr It is a translation. It will translate the key from any of the lang json files that it has loaded. About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
June 1, 20196 yr What do you mean “return the parameters null”? About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
June 1, 20196 yr Author 35 minutes ago, diesieben07 said: It's a varargs parameter. Oh I didnt know that. I thought it was necessary. Thank you
June 2, 20196 yr Author Seems that is not working correctly in my mod. https://github.com/cinsiian/Crystal/blob/master/src/main/java/cinsiian/crystal/CrystalHandler.java https://github.com/cinsiian/Crystal/blob/master/src/main/resources/assets/crystal/lang/en_us.json
June 7, 20196 yr Author Thank you, but how can i change the color of the translation. Is possible to use § codes?
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.