Where does en.json go in my mod folder if i want to make my mod translation friendly and or structured?

i know the contents could be somethign like

{
“entities” : {
“weapons”: {
“iron_axe” : {
“iron_axe_ghost” : {
“display_name” : “Iron axe”,
“description” : “a one handed iron axe.”
}
}
}
}
}

and then acces is via the right something.something.something, but where does the actual en.json file go? currently dont have acces to stonehearth’s.smod/zip to check because at work…

current best guess:
Vikingmod/locales/en.json

and then put a mixin in the manifest like
“stonehearth/locales/en.json” : “file(jobs/locales/en.json)”

1 Like

just make a folder locales :wink: and dont forget to add to your manifest “default_locale” : “en”,

1 Like

edited with my best guess, something like that :slight_smile:?

Nope, not quite.

vikingmod/locales/en.json

{
  "info": {
    "name": "vikingmod",
    "namespace": "vikingmod"
  },
  "default_locale": "en",
  "aliases": {
       ...
    }
}

@Moai sorry im not 100% sure i follow you:
you mean the inside of vikingmod/locales/en.json should be your lines of code?
and then “…” should be replaced with my snippet from the original post?
(this stuff:)
{
“entities” : {
“weapons”: {
“iron_axe” : {
“iron_axe_ghost” : {
“display_name” : “Iron axe”,
“description” : “a one handed iron axe.”
}
}
}
}
}

if i read you correctly? (possibly with one less tier of brackets {} )

No, that wasn’t what I meant. Have a look at another mod’s en.json file to see what it should be structured like. My post shows how to reference a localization file from your manifest. You don’t create an alias for it, you simply include it in the locales folder, and set the default_locale to whatever language you were writing for, in your case en.

Ah, so you were more refering to the manifest :stuck_out_tongue:yah i think i have that one correctly already, i was specifically looking for how to structure the inside of a file that keeps the names and descritions of my items*.
manifest

*since i dont have steam ready and on a work pc, but there is little to nothing to do at work but i do have notpad++ and my own mod’s folder… thought i’d do some cleanup

pps. this also means i dont have other mods handy, unfortunately.

That is indeed not correct. default_locale should not be a child of info, it needs to be on the same level as aliases and mixintos. Stonehearth used to pre-generate mods with default_locale under info, this was wrong and has been fixed a day or two ago.

As for structuring en.json, here’s a snippet (top part) of my miner’s localization file.

{
	"perks": {
		"work_1": {
			"name": "Mining techniques",
			"desc": "This hearthling has learned basic fast mining techniques."
		},
		"inv_1": {
			"name": "Ore bag",
			"desc": "A backpack fitting 2 extra items has been issued to this hearthling."
		},
		"speed_1": {
			"name": "Hurried",
			"desc": "This miner doesn't want to waste any time. Speed increased by 10."
		}...

Here’s how I would use these in the code.

   "level_data": {
     "1": {
       "perks": [
          {
             "name": "i18n(miner_prof:perks.work_1.name)",
             "description": "i18n(miner_prof:perks.work_1.desc)",
             "type": "set_miner_work"...

Didn’t you say you had an unpacked version of all of SH’s files on your work drive as well? That includes a en.json that you can also use as a reference.

2 Likes

on a usb stick which i used to take along…and forgot :frowning: thanks for the share thought, i can probably make some headway with this :slight_smile:

1 Like

so far JSONLINT likes it…
en2

90 lines of code and half my items and their recipes basicly done… if a small mod is already this much work for a language file, i dont want to know the amount for a full translation. god speed to fan translators…

1 Like

In SHED it’s so easy and fast to add the localization :disappointed_relieved:

I’m cringing at how buggy it is right now and how badly it supports the workshop mods. I wish I could fix it myself but alas, I need to help testing performance fixes and multiplayer bugs.

First things first ;), you can’t fix everything at once @Relyss

1 Like

I didn’t really like localization at first, either, but I’ve come to appreciate it. For one, my only released mod right now supports two languages out of the box, so I was happy that it allowed me to do that. For two, the localization documents provide a convenient storage of all in-game strings, so instead of typing the same thing multiple times when you need information copied over, you can refer to the same localized item. This also makes it trivial to update the names and descriptions of mods that add a large amount of items, like Yang’s Yings.

3 Likes

Yeah the updating is indeed the reason why I want to do it this way aswell. Well that and professional pride :stuck_out_tongue:
(god knows I will probably make a typo - somewhere–jsonlint is already a godsend to stop errors caused by those)