[Dev Blog] Desktop Tuesday: Localization Improvements

@Relyss: The key portion after my_mod: can be whatever you would like – you can even keep everything at the top level ex: my_mod:my_object_name, my_mod:my_object_description. It just specifies how to look up the string in the language file. I made it a long name for organizational purposes because stonehearth has a LOT of objects and it helps to be able to group them all under the same categories.

For changing description of existing stonehearth entity, you can either mixinto the stonehearth’s en.json (Option A). Or you can mix into that entity’s json file and change the description key to point to your mod (Option B). The difference is:
Using Option A: If the user uninstalled your mod, objects made with your mod would revert to their old description.
Using Option B: Uninstalling your mod would cause objects made with your mod to show with missing strings.

If you want to add your own entities in a mod, you can create your own en.json in your mod’s folder (my_mod/locales/en.json) and specify localized strings there. Then in your mod’s object file, the string keys would look like i18n(my_mod:some.string.key)

5 Likes