agsutils icon indicating copy to clipboard operation
agsutils copied to clipboard

[Feature request] Extraction and injection of .TRA / .TRS translation files

Open d0k3 opened this issue 2 years ago • 6 comments

Most people using agsutils (at least, imho) will just want to do simple edits, like sprite replacement, improvement of graphics and changing text (fixing typos, doing a translation). agsutils is already able to do all of the three, however editing text requires actual disassembly of scripts and handling complex files.

So here's my idea: Could you add support for extraction / injection of .TRS / .TRA files from / into game files? From my understanding, both are simple search-replace lists, with .TRS being in text format and .TRA being in a binary format. Extraction would be a very useful feature, as it would provide a start point for generating new translations (the extracted file would of course just contain the original strings). Injection would provide us with a simple way to edit all text in the AGS game file.

BTW: For editing existing translation files, there's already the excellent AGS Translation Editor.

d0k3 avatar May 17 '22 10:05 d0k3

a trs -> tra compiler already exists: https://github.com/adventuregamestudio/ags/blob/master/Tools/trac/main.cpp , however it requires to compile a big part of the heavy ags engine written in C++. so it might make sense to look at the relevant code bits and translate it to C. as for a "trs-extract" tool this could probably implemented in a straightforward way by processing all .s files' .string section.

can you post an example how such a file would look like ?

rofl0r avatar May 17 '22 16:05 rofl0r

Most people using agsutils (at least, imho) will just want to do simple edits, like sprite replacement, improvement of graphics and changing text (fixing typos, doing a translation).

i noticed that most users request such features, but the main intended purpose it was designed for is to fix bugs etc:

https://github.com/rofl0r/agsutils/wiki/Notes

rofl0r avatar May 17 '22 16:05 rofl0r

Here's a sample file (also coming from Maniac Mansion Deluxe v1.4): MMD14_German.zip

It's really extremely simple, just a text file with one line original text, linebreak , then one line translated text, linebreak, and so on. If you would do an extractor, I think it would be best to just use the original text as a placeholder for the translation. Btw, do you think it would also be possible to inject the .trs file back into the game file? I guess that would need actual recompiling, though.

d0k3 avatar May 18 '22 09:05 d0k3

Here's a sample file (also coming from Maniac Mansion Deluxe v1.4):

how did you produce it ? i can't find it in the zip you posted in the other thread. i noticed it contains the string "desk lamp" which is not in any asm source, but the name of a hotspot. it also seems to be in utf-8, even though old AGS engines support only window legacy codepages. so implementing this might not be as straightforward as i assumed. also the readme of the AGS translation editor seems to use a different TRS file format with numbered strings.

rofl0r avatar May 19 '22 09:05 rofl0r

My bad. I used the aforementioned AGS Translation Editor to convert the .TRA I had to .TRS, assuming the resulting files are compliant to standards. I'll look into this and will try to get a proper file.

d0k3 avatar May 19 '22 13:05 d0k3

My bad. I used the aforementioned AGS Translation Editor to convert the .TRA I had to .TRS, assuming the resulting files are compliant to standards.

after experiencing how ags upstream keeps changing file formats, i could well imagine that this was in fact the format used in ags 2.xish era, so AGS Translation Editor might default to emit TRS in the format corresponding to the TRA file. btw, did you ever try to open the ac2game.dat in the corresponding old AGS release's editor ?

rofl0r avatar May 19 '22 16:05 rofl0r