Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: miguel on Thu 05/01/2012 11:10:19

Title: .trs file question...
Post by: miguel on Thu 05/01/2012 11:10:19
Hi there,

I've had some problems when updating a translation file into a game,
is this the right way to do it?

-change the new .trs file for the old one;
-'Update All' where it says Translations on the Editor;
-Compile the new translation file;
-Make new exe (in my case because the game is finished);

Thanks
Title: Re: .trs file question...
Post by: Khris on Fri 06/01/2012 06:14:05
If all you did was update translated lines, you can skip steps 2 and 4, afaik.
"Update" will add changed/newly added game strings to the bottom of the translation source, and compiling the game shouldn't be necessary if all you changed is the translation file (since the game source didn't change).
Title: Re: .trs file question...
Post by: miguel on Fri 06/01/2012 10:38:25
Thanks Khris but I can't do it right, looking at the .trs file I can see that it has repeated lines, some "spell-corrected" and some in their original form. I followed your example but it still doesn't work.

Is there a way to erase the original lines completely so that it doesn't get repeated? Somehow the editor ignores the new .trs file...
Title: Re: .trs file question...
Post by: Khris on Fri 06/01/2012 17:50:19
I don't think there is.

What exactly IS the problem? Are you unable to update the .tra file?
Title: Re: .trs file question...
Post by: miguel on Fri 06/01/2012 20:38:30
I can't seem to do it, no.
Somehow the editor is not updating the new .trs...
Title: Re: .trs file question...
Post by: miguel on Mon 09/01/2012 10:17:20
Sorry to double post here!

Did anybody had the same issue with translation files?
Title: Re: .trs file question...
Post by: Khris on Mon 09/01/2012 10:56:20
So you update the source, put the translated lines into the empty ones below the original text, save it, recompile the source but the translation doesn't show up in the game?
Title: Re: .trs file question...
Post by: miguel on Mon 09/01/2012 13:38:50
I didn't explain my problem well,

the .trs file being changed is for proof-reading matters.

I've tried to do in some different ways but it somehow doesn't get all text modified...
Title: Re: .trs file question...
Post by: arj0n on Mon 09/01/2012 15:03:20
Quote from: miguel on Mon 09/01/2012 13:38:50
the .trs file being changed is for proof-reading matters.
Being changed as in only changing the original lines (not using the empty lines) or changed as in only using (filling) (some of) the empty lines?
Title: Re: .trs file question...
Post by: miguel on Mon 09/01/2012 16:07:33
Being changed as in only changing the original lines...

First time I did it, the Editor "asked" me to include actual translations lines and I added just 3 letters on the first empty line...
Title: Re: .trs file question...
Post by: Khris on Mon 09/01/2012 19:05:38
That's the problem right there, you aren't supposed to edit the original lines. (It doesn't break the game but as you noticed, it doesn't have any effect.)

You can "abuse" the translation feature by putting corrected lines below the original ones; if that "translation" is selected in winsetup, the game will use the corrected line whenever it finds one, just like if it were an actual translation.

But in order to correct the original lines, you have to edit the game's source within AGS.
Title: Re: .trs file question...
Post by: miguel on Mon 09/01/2012 20:38:44
Okay, I got it now. Dumb Miguel!

That means that I actually have to manually copy/paste lines, right?

Thanks for the help guys.
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 12:16:01
Sorry for double posting but now that I've managed to get the translated file working it seems that my gui for reading the screen hotspots doesn't work!

It's a simple gui with a label '@OVERHOTSPOT@' like I've always used before...

All lines containing Hotspot1,2,3... have been duplicated. Is that what's causing the error?
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 12:40:37
What error exactly...? What doesn't work?

Does the label actually read "@OVERHOTSPOT@" in-game?

Did you remove duplicate lines from the translation source?
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 13:06:09
Sorry I said 'error', the game doesn't crash but
   the label reads a static name (reading the file I found it's the first name right under @OVERHOTSPOT@), I've inserted a blank line and the label reads the screen correctly up to a point.

It seems that character names got changed and inventory item names also.

I did remove duplicate lines as I was trying to fix the static label, but  because it didn't work I am using a file with everything duplicated now.
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 13:43:32
It's really important that you don't mess around in the translation file. You can't remove or insert lines at any point without screwing up everything.

Create a fresh translation source (create a new translation in the project tree), open it and the current translation file next to each other and go through them line by line. That's the only thing you can do short of copy-pasting every translated line in a newly created source.
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 14:53:07
Got the file and looked at it.

I have no way of telling what's wrong with it.

First of all, if a line doesn't need to be translated, you can leave the line below blank. I don't even want to think about sitting there and pointlessly duplicating all those lines by hand for no reason at all. (And this is stated right at the top of the translation source.)

I guess at this point it's best if I explained how AGS handles translations internally. When a game is started with a translation selected, AGS loads the entire contents in a buffer.

Suppose the translation file looked like this:

1: Some text
2: Irgendein Text
3: Some more text
4: Noch mehr Text
5: Hallo!
6:
7: How are you?
8: Wie geht's dir?

So now the game is run, and AGS encounters this line: Display("How are you?");. AGS will now search the translation for the string "How are you?", looking only at lines 1, 3, 5, 7, etc.
An exact(!) match is found in line 7, and line 8 isn't empty, so AGS displays line 8 instead.

In other words, if you change the original lines, AGS can no longer match the game source text to the translation file's original lines.

That's why right at the top of the translation, it says this:
// ** REMEMBER, WRITE YOUR TRANSLATION IN THE EMPTY LINES, DO
// ** NOT CHANGE THE EXISTING TEXT.


It also seems like somebody removed all the comment lines further down. That didn't break anything but I don't really get why one would do that.

Long story short, since this is just to fix spelling errors: either fix them in the game source or create a fresh translation source and put the errors back in the original lines.
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 17:05:24
Right, thanks for all the troubles Khris,

I still can't get it to work, the file I sent you has the exact command lines than a new one, I don't understand when you say somebody changed it.

I even have the game running fine now, but it doesn't run the new translation after setting it up in the setup...

I'll manage something.
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 17:15:19
It looks like AGS no longer puts comment blocks further down in the file like it used to.

So you created a new translation source, put corrected lines in the blank spaces but they don't show up in the game when you select that new translation?
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 17:33:05
Yup, that's it.

I'm supposed to compile the new translation file, nothing else?
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 17:38:55
I don't think so but better rebuild all files to be on the safe side.

Did you copy the new .tra file into the Compiled folder?
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 17:44:35
Well, the editor builds a .tra file and puts it in the compiled folder, I can only edit (I think) .trs files witch are on the game folder...

Am I supposed to edit the .tra file itself?
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 18:18:46
No, sorry. I was actually updating a translation for a game made with 2.72 yesterday and back then you had to copy the tra file yourself.

You aren't supposed to edit the tra file, no. It isn't in plain text anyway.

You are positive that the game ignores the translation although you have selected it in winsetup? Could you send me the new trs file?
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 19:47:55
I'm positive that it ignores the file.

I've sent you the file...
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 20:30:33
I just realized something.

Look at this:

That's the biggest bed I will ever see in my entire life!
That's the biggest bed I will ever see in my entire life!
That might just be true, my boy!
That might just be true, my boy!
Its design is unique, you see?
Its design is unique, you see?
Oh, yeah! It has design all over it!
Oh, yeah! It has design all over it!
Right, well...can you please stop staring at it?
Right, well...can you please stop staring at it?


This is a random snippet of the file you sent me but the other 2100+ lines look exactly like this, as you know.

Now, you say that your game ignores the translation file.
May I ask: how can you tell?
Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 21:16:59
Right from the beginning, there's a dialogue, I wrote profecy and of course my proof-reader corrected it to prophecy, amongst other things that I can spot on the first room.
AGS runs MY texts and not the .tra file ones.

What you see is the corrected file, are you saying that AGS doesn't translate equal lines? It only uses the .tra file if there's no match?

Title: Re: .trs file question...
Post by: miguel on Tue 10/01/2012 21:31:11
Okay, I see what you're saying, the new translation file has the core texts and I should work under it, what I've done with all the copy&paste was replace the full text and that doesn't match.

I wanted to be smart and save time but I ended up having to do it all again, in the process I screwed everything, lost a day, my wife thinks I'm a asshole and I've ruined your day as well and you probably think I'm a asshole! :=

I hope I'll not torment you anymore with this Khris, you're a hero!
Title: Re: .trs file question...
Post by: Khris on Tue 10/01/2012 22:00:11
What I was saying is that when you sent me your latest .trs File, I expected some of the translation lines to differ from the original lines.
Just like in the example you gave, correcting a line often adds or removes a letter.
While I didn't read it meticulously, I went through it page by page and gave the line endings a quick look. What I found was that all translation lines seemed to be identical to the original ones and thus I was wondering how you could tell whether that "translation" was used or not in-game.

Also, looking at the file you sent, if doesn't say "profecy" in there anywhere and it seemed to me that you were still using a translation source that had altered original lines.

And, of course I don't think you're an asshole. :)