The easiest way would be to add the text directly to the name and description, so that it looks like this:
},
"unit_info": {
"display_name": "bar shelf",
"description": "Got to have some where for those cups.",
"icon": "file(bar_shelf.png)"
However, it’s recommended to create your own locale file that has those texts within them and use an i18n
path to refer to each text.
First of all, the MY_MOD/locales/en.json file has to be created. It will contain any and all text that an "i18n(...)"
is looking for.
Here’s an example of an en.json file that would work for your bar shelf:
{
"entities": {
"decoration": {
"bar_shelf": {
"bar_shelf_ghost": {
"display_name": "bar shelf",
"description": "Got to have some where for those cups."
}
}
}
}
}
It will work similarly for all other text, just make sure to add the text to the locale file when needed.
For the game to register that you have a locale file in your mod, you’d have to go into your mod’s manifest and add a "default_locale"
entry, like so:
{
...
"default_locale": "en",
...
}
You’d also have to edit bar_shelf_ghost.json so it can find the correct localized text. To reflect the en.json example above, it’s going to look something like:
},
"unit_info": {
"display_name": "i18n(MY_MOD:entities.decoration.bar_shelf.bar_shelf_ghost.display_name)",
"description": "i18n(MY_MOD:entities.decoration.bar_shelf.bar_shelf_ghost.description)",
"icon": "file(bar_shelf.png)"
There’s only a few differences to this and what you supplied. The obvious change was that, instead of stonehearth, you’re going to have to write in the name for your own mod; since that’s the one that has the correct locale file. The other change was to add a missing “_ghost” string to the description path (you could have it without “_ghost”, but then the locale file has to be changed to reflect that).
Hope it helps!