Tkh's Translation Helper program (downloadable)

Oh, don’t worry. My intention was to find the missing lines. But I later noticed that I can click in one of the button to add everything missing from one file to the other. It is just that it is kinda hard to know what the buttons do. For example, the little radio buttons, I have no idea what they do, clicked them all and didn’t noticed anything different.

The radio buttons are used with the search function. If you select Tag and type something in the textbox to the right you can search downwards or upwards for a tag (a key) that contains that bit of text. By selecting Org or Trans the search will be performed in the Original or the Translation columns.

For example, let’s say you used to translate “Hearthling” to “xxx”, but now wants to translate it to “yyy” instead. Then you can type “xxx” in the textbox, select “Trans” and just klick “Find Next” to find every place where you had the old translation and just step through the file. Or you can type “Hearthling” in the textbox and select Org to find all places from the original file.

This was explained and demonstrated a few minutes into the video in the first post :wink:

1 Like

Bug report:

That orange lines are supposed to be a single line.
If you go into the stonehearth en.json you will find this:

     "cultist": {
        "cultist_trait": {
           "display_name": "Cultist",
           "description": "This hearthling keeps mumbling about some sort of secret \"bunny god\" sleeping eternally. What's that about?"
        }
     },

There was multiple lines where this problem occurs

edit: solved with a kind of workaround, see further down.

Thanks for the report, I can verify the bug. This has not been a problem before as I know of.

Seems like the problem is that there are lots of texts now that use " within the string. To make that possible (to not end the string) they use the \ + " combination. Now, the problem is that this combination is not supported by my program (for the moment). It will see the " and interpret that as an end of string.

I’m not sure how to solve this… and it’s quite serious if Radiant wants to do this. It was @yshan who fixed the read-file part last time, and I wonder if I have to ask for help to solve this. @sdee : do you or anyone in your team have any suggestion or tips?

Is your software code somewhere where we can take a look? Maybe it is not something hard to fix. (Although I only have experience with delphi and java, which I guess none was used in this)

@tkh had tried to make it open source before, maybe it’s time to get it done. :grinning:

I know, and it’s really time to do that. I promise I’ll try to get this done and put it on github :blush:

1 Like

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 :wink:

1 Like

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 :slight_smile:

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…

1 Like

Do you mind if I try to recreate the translator into a webpage?

1 Like

I would not mind, feel free to make a better version :slight_smile:

1 Like

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.

1 Like

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.

2 Likes

Will check and report back soon.

I saw your newtonsoft library XD i was also working with that lib.

Cool, thanks! :+1:

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.

1 Like

It works well for me.

1 Like

Ok, good start, thanks :+1:

1 Like

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 :wink:

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.

2 Likes