User Tools

Site Tools


tutorial:lang

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorial:lang [2022/05/27 15:52] solidblocktutorial:lang [2024/02/06 10:26] (current) – minecraft wiki rawdiamondmc
Line 3: Line 3:
  
 ===== Creating a lang file ===== ===== Creating a lang file =====
-You can use lang files to provide translations for translatable strings in-game. You'll need to create a file with an appropriate file name for your language-- to find your languages' code, visit [[https://minecraft.gamepedia.com/Language|this link]]. English is en_us. Once you have your language code, create a JSON file at __resources/assets/modid/lang/__; a full example for an English translation file would be __resources/assets/tutorial/lang/en_us.json__. +You can use lang files to provide translations for translatable strings in-game. You'll need to create a file with an appropriate file name for your language-- to find your languages' code, visit [[https://minecraft.wiki/w/Language#Languages|Minecraft Wiki]]. English is en_us. Once you have your language code, create a JSON file at __resources/assets/modid/lang/__; a full example for an English translation file would be __resources/assets/tutorial/lang/en_us.json__. 
  
 ===== Adding a translation ===== ===== Adding a translation =====
Line 76: Line 76:
 </code> </code>
 Then add the ''<yarn class_2588>'' parts individually: Then add the ''<yarn class_2588>'' parts individually:
-<yarncode java For versions 1.18.2 and below>+<yarncode java
 +// 1.18.2 and below:
 tooltip.add(new class_2588("item.tutorial.fabric_item.tooltip_1")); tooltip.add(new class_2588("item.tutorial.fabric_item.tooltip_1"));
 tooltip.add(new class_2588("item.tutorial.fabric_item.tooltip_2")); tooltip.add(new class_2588("item.tutorial.fabric_item.tooltip_2"));
-</yarncode> + 
-<yarncode java For versions since 1.19>+// 1.19 and later
 tooltip.add(Text.translatable("item.tutorial.fabric_item.tooltip_1")); tooltip.add(Text.translatable("item.tutorial.fabric_item.tooltip_1"));
 tooltip.add(Text.translatable("item.tutorial.fabric_item.tooltip_2")); tooltip.add(Text.translatable("item.tutorial.fabric_item.tooltip_2"));
tutorial/lang.1653666762.txt.gz · Last modified: 2022/05/27 15:52 by solidblock