@tkh had tried to make it open source before, maybe it’s time to get it done.
I know, and it’s really time to do that. I promise I’ll try to get this done and put it on github
edit: have a fix for this, see post further down.
Yeah, you can take a look in the project. Here’s a dropbox link:
edit: removed, project can be found on github (check the other thread)
I guess we must somehow go through the file and check for such combination(s) and replace with a html code or something like that. Or ask Radiant (@sdee and friends) to never use quotes
Ok, just as I posted the previous post I thought of the time where I fixed the special characters (forward slash and other chars). And I thought that perhaps this was already taken care of in that update.
And it seems like we had a solution for this already. Just replace all instances of the \ " combination with the html combination and things will work out just fine. This was used already as there were 8 instances of the html code already
Just replace all
\"
with
"
and things should work just fine!
edit:
The original file has 8 instances of the html combination and the new file had 22 instances of the \ " combo. So Radiant knew this before but someone took a shortcut that doesn’t work well with my program. But the new translation file will be saved with html formatting. But if Radiant keeps on releaseing files with the \ " combination we have to manually fix it every time…
Do you mind if I try to recreate the translator into a webpage?
I would not mind, feel free to make a better version
Seems like this has to be fixed. I just don’t know how… yet…
General update:
I have put quite some hours into fixing this, but no success yet to make an easy fix. Every time I think I’ve found a solution something else pops up to ruin everything.
So I took some help from a friend and he provided me with a new class to use. Instead of a flat list of strings the new class includes a list of itself which saves the entire json structure which then easily can be generated back. It works fine in a test program and solves the problems I face by using existing libraries.
This, however, means that I need to re-write all parts of the program that handles file read/write and data handling (not far from starting from scratch). So you can expect an updated version at some point, but there is no ETA.
New release: v0.7.0 link is removed due to new release
Experimental v.0.7.x is the result of a lot of testing with a proper json lib (in zip file), but it’s only implemented for reading. Still using the old write function, but it seems to work quite well with the exception that some characters are saved as escaped. So far I’ve actually only seen the forward slash ‘/’ but I haven’t tried all.
This means that /
will be saved as \/
, but it works fine to read back into the program later. I just don’t know how it behaves ingame yet.
edit: Of course I could do a full scan of the file after save and change all \/
to /
again, it’s a simple workaround but I don’t really like it, and there might be downsides with that as well.
Calling @BrunoSupremo, @dalabo, @Kiyoshi, @law, @Wiese2007
Feel free to test! Both the standalone program and also the generated files in game.
Will check and report back soon.
I saw your newtonsoft library XD i was also working with that lib.
Cool, thanks!
Yeah, it seems to be the most recommended library for working with JSON. But I haven’t found a good way to convert the old export to use this lib instead. Yet.
It works well for me.
Ok, good start, thanks
There is hope after all, I just managed to implement the save function as well - using the json.net
lib. The XML library is totally removed! So I will re-package and test the 0.7.1 release a bit more before releasing it. So far the testing looks good and it can handle all characters I’ve tried so far. Only escaping "
and \
as far as I know.
Will be back with the new release in a day or six
By the way, any use of HTML export mode now? I have disabled it for the time being since we should not need it when using the new library.
It’s funny how small things just keep popping up One thing led to another (like empty strings in the original file, I wasn’t prepared for that) and now I have a new rule:
If a key/value pair is removed from the original file (it happens every now and then) and you open a translation file; it means that the tag can’t be matched to an existing tag. Before I just added them in the bottom and I think I didn’t save them. Or did I? Anyway, now they don’t even show up. A note is added to the log and I’ll consider a popup (similar to doublets warning) to notify you of this.
This means that the tag name/paths in the first column will be from the “original file” and nothing more should be added there, and the saved file will use that column and build the new file from that exact structure. I think this is the most correct way of doing it.
Since the new alpha (24) was released today I feel that I have to put out a new release as well. Please use the new version and get started translating! According to my program the Stonehearth/en.json file now has 7500 rows that needs your attention!
Please check the first/top post for a download link so I only need to update one post at a time.
I have done some testing and things look good so far, for example, if I open a file, click “reset all” (fill all translation blanks with a copy of the original file), the saved file is identical to the original.
edit: please save often and do a few double checks now in the beginning until we know it’s stable and so on.
New release (0.7.2)
- Re-implemented the function to search for duplicates (it has been disabled for some time). Can only occur if the original file has some errors (because it shouldn’t happen). Files saved by the program will not save duplicates. It’s a bit slow so I’m considering removing it again. 7500 tags takes 0.7s to check on my laptop.
- General code cleanup, comments and stuff
Download in the first post:
So since Stonehearth is released I guess things won’t change much after this. I hope you all have used this program for some time now, and that it works, because I get no bug reports.
Are there any features missing? Otherwise I’ll just do some cleanup and then release the program as 1.0 as well. Code is already on GitHub as you know.
Hi, first thank you for this tool
i have a stupid question, the files in Stonehearth\locales\ are a .pak files now (long time i didnt play with Stonehearth ) how open / extract this .pak files for use the .json files with your tool ?