bbepis / XUnity.AutoTranslator

MIT License
1.88k stars 288 forks source link

Hooking text. Again. #3

Closed clipboards56 closed 6 years ago

clipboards56 commented 6 years ago

Heya, sorry to bring this issue up again but would it be possible to add the feature to copy untranslated text to clipboard automatically as it appears in game? This would be very appreciated as the usual text hooking software(ITHVNR and agth) don't work with Koikatsu for some reason. Copying to clipboard would let people use translation software of their choice as Google translate alone is inadequate most of the time. Maybe there could be a toggle/config file setting for the automatic copying and a manual input to copy the latest text(in a dialogue window for example)?

Cheers.

ghost commented 6 years ago

I can try it out. But please provide me with a guide as to how I would go about testing it. Never used this software before, and it wasn't immediately obvious after downloading it.

clipboards56 commented 6 years ago

A simple way to test it would be just to 'paste' from clipboard into Notepad text file after text appears in game. Or if you want to go all the way with the testing you could get Translation Aggregator here: http://www.hongfire.com/forum/forum/hentai-lair/hentai-game-discussion/tools-and-tutorials/68499-translation-aggregator/page100#post4548026 (post #1491) Launch it and test like this: https://imgur.com/a/dJ20aGC. (Just to be clear: I manually copied the original text from the dump file for this picture to illustrate how I'd like it to work.) If the 'Original Text' box isn't on by default you can switch it on in the 'Window' menu.

Hopefully this helps.

ghost commented 6 years ago

Thanks for the instructions. Useful tool indeed.

Anyway, I made a version that I got working, could you try it out?

XUnity.AutoTranslator-BepIn-2.4.0.zip XUnity.AutoTranslator-IPA-2.4.0.zip

Example of configuration:

[Service]
Endpoint=
EnableSSL=False

[General]
Language=en
FromLanguage=ja

[Files]
Directory=Translation
OutputFile=Translation\_AutoGeneratedTranslations.{lang}.txt

[TextFrameworks]
EnableIMGUI=True
EnableUGUI=True
EnableNGUI=True
EnableTextMeshPro=True
AllowPluginHookOverride=True

[Behaviour]
Delay=0
MaxCharactersPerTranslation=150
IgnoreWhitespaceInDialogue=True
MinDialogueChars=18
ForceSplitTextAfterCharacters=0
CopyToClipboard=True
MaxClipboardCopyCharacters=450

[Baidu]
BaiduAppId=
BaiduAppSecret=

[Debug]
EnablePrintHierarchy=False
ghost commented 6 years ago

Note, that the CopyToClipboard defaults to False, so you must set it explicitly.

ghost commented 6 years ago

Also, note it may very well skip some text if it is overwhelmed. For instance, when you enter the char editor, there's more than 1000 texts that wants to be translated.

Also, it will wait with copying text to the clipboard until the text that it wants to copy has not changed for atleast 0.5 seconds.

clipboards56 commented 6 years ago

Yes, this works exactly like I wanted. Thank you very much! I noticed a small issue though with the first line of dialogue not getting copied correctly when first talking to a character on the map or choosing a conversation topic from the side menu. The rest of the dialogue is copied fine until the dialogue window pops up again. I guess the UI text spam or other hidden text messes with the process. Example here: https://i.imgur.com/0t6kbhW.jpg A manual input to copy the "active" text on the window would help but I can totally live with this issue as the missing line can be "fetched" by opening the ingame text log.

ghost commented 6 years ago

I don't think there's much I can do about that for now, so I will close this.