Translation problem ( Chinese )

Sure, it’s still somewhat configurable in the program. Just want to see if this works.

Oh, yes I can. But I could before as well :wink: To show the Swedish characters åäö I can use “Default” or “UTF8-NoBOM”. Using HTML looks exactly the same. The only thing is that they are not in the same size or have gaps around them… but I blame the font for that.

I’m more curious how Chinese looks in the game when using the HTML function in my program. I can’t try myself until tonight when kids are put to bed.

Doesn’t seem to work… @RepeatPan, please advice.

I used google translate to throw in a few words into my program and then I exported the file three times with HTML checked. None of them looks the way we want it to. Two tags are still in Swedish (and they look as expected). Result is inspected in notepad++.

1 - Default

    "title_screen_exit" : "??",
    "title_screen_settings" : "??",
    "title_screen_credits" : "medverkande",
    "title_screen_kingdom_of" : "Kungadömet",
    "title_screen_continue_game" : "??",
    "title_screen_new_game" : "???",
    "title_screen_load_game" : "????",
    "title_screen_quick_start" : "????",
    "title_screen_patch_notes" : "??????",

2 - utf8

    "title_screen_exit" : "出口",
    "title_screen_settings" : "设置",
    "title_screen_credits" : "medverkande",
    "title_screen_kingdom_of" : "Kungadömet",
    "title_screen_continue_game" : "继续",
    "title_screen_new_game" : "新游戏",
    "title_screen_load_game" : "加载游戏",
    "title_screen_quick_start" : "快速启动",
    "title_screen_patch_notes" : "显示补丁说明",

3 - utf8 w/o BOM

identical to previous

Like I’ve said, use the function I’ve linked above, or the one I’ll attach here too.

Input: 加载游戏
Output: 加载游戏

string str = "加载游戏";

StringBuilder sb = new StringBuilder();

foreach (char c in str)
{
    int value = Convert.ToInt32(c);
    if (value > 127)
        sb.AppendFormat("&#{0:0000};", value);
    else
        sb.Append(c);
}

Console.WriteLine(sb);

You need to translate the stuff to HTML entities. Forget about UTF8 for now.

Check, hope I can find time tonight to do it.

/bbl with result.

Damn, I just had to… and I have 15 minutes to do 60 minutes of expected chores before they come home from swim school.

It works like a charm I think. Exported result with HTML below (but since the program is the way it is I still need to pick an encoding, so using UTF8 w/o BOM).

    "title_screen_exit" : "出口",
    "title_screen_settings" : "设置",
    "title_screen_credits" : "medverkande",
    "title_screen_kingdom_of" : "Kungadömet",
    "title_screen_continue_game" : "继续",
    "title_screen_new_game" : "新游戏",
    "title_screen_load_game" : "加载游戏",
    "title_screen_quick_start" : "快速启动",
    "title_screen_patch_notes" : "显示补丁说明",

@law Please test this SW:
https://db.tt/RWeMcSg3

No time for screenshot though, but it looks ok for my title screen to start with.

1 Like

I try to use your software, HTML is derived from the json file, if do not conform to the format, the game read error. The error is me?

We’re talking about how to translate the name of the entity?

unit_frame.html :



{{#if stonehearth:job}}

<img {{bind-attr src=“stonehearth:job.class_icon”}} />

{{/if}}

{{unit_info.name}}

{{unit_info.description}}


" {{unit_info.name}} " This code is referenced in the xxxx.json file “name”: “________.” is a literal reference. I think the translation is not successful, this is the key.

Please show exactly how you did. I want screenshots - lots of them! :smile:

Oh, and just to be clear, I did this in the big gui file (locales/en.json).

I can record a video later tonight and show how I did it.

Ok, I’ll screenshots, I demonstrate it simple

Entity names can currently not be translated.

Right, I hope is to be able to translate the name of the entity. Hope to solve as soon as possible. Or is it a severe programmers to deal with him.

Didn’t find (gave myself) time to record that video yesterday, but here’s how it looks. Can’t show ingame pics right now, so just take my word for it that it worked on the title screen. I haven’t tried with the other files for items and such, but I think @law has done that testing already. And basically, there’s still where the problem lies as I understand it.

But we also have the old problem where the game doesn’t understand UTF8, perhaps that’s the root cause of all this evil…

My old and new code, based on the example from @RepeatPan. First the class:
(Can’t get this post to behave with the spacing in the code block!)

[code]
//Returns a JSON formatted row with both tag name and translated value ready for export
public string PrintJsonRowTrans()
{
return “”" + tagName + “”" + " : " + “”" + tagTrans + “”,";
}

//Returns a JSON formatted row with both tag name and translated value ready for export but in HTML
public string PrintJsonRowTransHTML()
{
return “”" + tagName + “”" + " : " + “”" + myHTMLconverter(tagTrans) + “”,";
}

private string myHTMLconverter(string inputStr)
{
StringBuilder returnStr = new StringBuilder();

foreach (char c in inputStr)
{
    int value = Convert.ToInt32(c);
    if (c > 127)
        returnStr.AppendFormat("&#{0:0000};", value);
    else
        returnStr.Append(c);
} 

return returnStr.ToString();

}[/code]

And this is obviously how I call it:

if (isHtml)    //Print row with HTML formatting
    wr.WriteLine("    " + allData[i].PrintJsonRowTransHTML());  
else           //Print row according to JSON format    
    wr.WriteLine("    " + allData[i].PrintJsonRowTrans());      

So moving on to how it looks in the program:

And the utf8 w/o BOM file:

And when exporting in same encoding, but with HTML:

As said, the title screen looks good with this. I don’t know what to do next, I think @sdee & co. have the ball now?

@tkh Right, I just want to say “export HTML” file is wrong, wrong format.Now translation is very convenient, thank you for your work

How do you mean, wrong?

@tkh When I export HTML file is wrong

@law But how does it look in the exported file? :wink:

I don’t know how to express, do not export HTML file will not wrong, the function of the other is no problem

I’m sorry, I just don’t get it… :confused:

Just to be clear, my program don’t support the item/class/etc. files. And it seems like the game doesn’t fully support those files being translated like we do with the gui file.

dont worry thats normal mostly i need three answers to get what he want :wink: but its normal in chinese they have complete other word order ^^

Right, we have completed the other translation, thank @tkh for your work