User Tools

Site Tools


tutorial:lang

This is an old revision of the document!


Name translations

Notice how your item has a weird display name, such as item.modid.my_item? This is because your item's name doesn't have a translation in your game's selected language. Translations are used to support multiple different languages for a single string.

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 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/wikitut/lang/en_us.json.

Adding a translation

After you've created the lang file, you can use this basic template to add translations:

resources/assets/wikitut/lang/en_us.json
{
  "item.modid.my_item": "My Item",
  "item.modid.my_awesome.item": "My Awesome Item",
  [...]
}

where the first string is any translatable string (such as an item name, or TranslatableTextComponent). If you're following along in the wiki tutorial, remember to change modid to wikitut, or whatever modid you've chosen.

tutorial/lang.1559248627.txt.gz · Last modified: 2019/05/30 20:37 by jamieswhiteshirt