Obviously, all our recipes need to specify a workshop, but what other subtleties are going to need attention?
If all you are doing is adding new items with their recipes, then that’s probably all you absolutely need.
You could also look at doing internationalization too. Yshan has added an example mod for locales to the stonehearth github. This is absolutely not required, but will make it easy if someone wants to translate your mod into another language. It will also make it pretty easy to bulk update the text strings if you need to, since they’ll all be in the same place…
Actually, it doesn’t look like the internationalization works within mods yet, only the main “stonehearth mod”.
Really? Hmmm… @yshan this was supposed to work for mods already? I thought so, but I haven’t tested it yet.
Tested it before and it worked for me. Could you show what you did in your mod?
I tried and failed too.
Right now, an item string “i8ln(something:something.something)” will appear in game as the literal something:something.something rather than my translation. As per what @yshan said here, I’ve put the en.json file in my_mod/locales/en.json and the game should just read that without me having to add anything to the manifest. It doesn’t work.
Hi @Tuhalu
Did the string start with i81n or i18n?
It should be i18n
Thanks
-Yang
Sorry, that was typo just now. I used i18n in the actual file.
Here is the mod that I was using to see if I could do it. I’ve created a full en.json file, but I’ve only added the i18n strings for messy_bookshelf… I stopped when I realised it wasn’t working
bookshelf.zip (21.7 KB)
The biggest problem there is the dot in your en.json where there should be a comma (at the end of the file) which causes the file to not load at all.
The other problem I noticed was in messy_bookshelf_recipe.json where description
refers to stonehearth.
Well, I fixed the syntax error with the full stop on my end, but it still isn’t working for me even though www.jsonlint.com says the json is now valid. The recipe error is no biggy, I just forgot that I played with that too.
This is peculiar, I tried it myself now and I get the same result as you.
Thinking about it some more I managed to get it working via html so perhaps there’s something with json files that’s not working correctly yet, @yshan?
Also, the log is spamming “resources | error loading file stonehearth/locales/sv.json: invalid file path 'stonehearth/locales/sv.json'.
” (a 1 minute long playtime produced almost 9000 of those lines</strike through>).
Edit: Scratch that, it was actually more like 4500 lines. Still a lot though.
Oh oops, okay I see the issue now.
By default, locales aren’t loaded unless the manifest has a ui / js or ui/html section. I’ll work on a fix for this.
In the meantime, you can fix it by adding this statement to the end of your manifest:
“ui” : {
“html” : [
]
}
It doesn’t do anything, but it forces the locale json to load.
Sorry about that!
-Yang
Well that explains it!
As a work around I’ve been mixing my en.json into stonehearth’s and just calling from stonehearth. It would make other translations easier too, as all you do is make a new lang file and mix that in to the (future) stonehearth one. I dunno if either system is technically better…
Edit: Has anyone managed to update crafters to A12? I’ve been tinkering around looking at how it’s all changed but I think my class controller needs an overhaul. Also, where/how can we add a new button to the crafters sub-menu? I feel like I’ve forgotten how to mod lol :’(
Thanks, capotzalco, for mini-necroing this thread to bring it back to the front page. I completely missed all the replies from about a week ago. I need to pay more attention to the threads I start beyond a couple days! I hadn’t thought about mixing into Stonehearth itself, because I figured if someone made a translation file that included a bunch of mods, it might be problematic if someone else tries to use the translation file but didn’t have the same mods installed. The more I think of it, though, superfluous info is not going to be an issue the way missing strings would be.
Thanks, Yang, as well for figuring out the problem. When my mod was crashing, I had just thought the internationalization wasn’t fully implemented. Now I just need to go back and add the “i18n” to all my strings!
Hmm. I’ve been lazy and haven’t updated my mods until now. But I found that in the latest version (develop 2628), the extra bit of json in the manifest doesn’t seem to be making any difference. Even the example that I included in this thread isn’t “fixed” anymore. Any thoughts @yshan or @Drotten?
Current version of mod in question: bookshelf.zip (21.7 KB)
The description of the messy bookshelf recipe should be using the translation, but it only shows the i18n URI.
I can confirm that it doesn’t work; even that which worked before for me doesn’t anymore. I believe it’s been hard coded somewhere to only look for the stonehearth mod’s locale file.
I found a workaround by doing a mixinto to stonehearth’s en.json file, and referred to that mod within all the i18n
strings.
I guess I’ll use that workaround for now then. It didn’t sound like the intended functionality when yshan was originally commenting though
I really doubt it is (intended I mean). I’m not all too sure it’s hard coded, but that’s what makes sense to me considering the behavior. At least it will be quick to make the change back when it does get fixed (just gonna do a find/replace in all files for “i18n(stonehearth
” to “i18n(my_mod
”).