Code in translation file and other trs/tra problems

Started by , Tue 11/06/2013 21:25:33

Previous topic - Next topic

m0ds

To those in the know or with translation experience (the engine side stuff) - I could not find anything discussing this before but I'll remove this if someone finds a post. I have a couple of questions about translation file and the editor:

The majority of my trs file exports exactly as expected, and for the most part, it's just line numbers and simple text element translations, ie

Quote
&1311 I didn't watch the news! We had cartoons on all day!
&1311 Je n'ai pas regardé les nouvelles! Nous avons eu des dessins animés toute la journée!
&50 You should pay more attention to what's happening to this country, Susan.
&50 Tu devrais prêter plus attention à  ce qui se passe dans ce pays, Susan.

Yet in the middle is a gigantic bit of code. Which starts like this:

Quote
&121 Mother's always told me not to accept any gifts from strangers...
&121 Ma mère m'a toujours dit de ne jamais parler aux étrangers...
I don't want her to take it! I might find a better use for this drug.
Je ne veux pas lui donner ça! Je trouverai sans doute un meilleur usage pour ce médicament.
Who should I give it to?
A qui donner ça?
);
       }
       if(cEgo.Room!=38){
 
  Display(

);
}

function iBar2_Look()
{
Display(

);
}

goes on and on and ends abruptly like this:

Quote
else if(player.Room==126 && player.x>=1340 && pick_lock2==2){  ///when jesse's gone and lock has already been picked

                HotspotBar=false;
gCustomOptions.Visible=false;
UnPauseGame();
RestoreWalkableArea(1);

cEgo.LoseInventory(iMitzi);
cEgo.AddInventory(iMitzi);

    DisplayAt(20, 450, 780,

&1795 Now that he's gone, we can get inside...
&1795 Maintenant qu'il est parti, nous pouvons entrer à  l'intérieur...
&791 Yes. Let's do that!
&791 Oui. Faisons-le!

1st question: Is this normal for the trs file to contain code, and for it to end abruptly (notice there is no closing brace etc) ?

For the most part, it seems the translation is working fine, when just attached as a standard tra file.

But when I try and make that trs file the default language (and built into exe etc) problems begin. What occurs then, despite a successful update, is that AGS picks out a random line in one of the last rooms (156/165) and says "you may have forgotten a closing bracket on a previous line", and this is not the case, as before the translation the game ran fine, and because I checked all lines within that room and this is not the case.

BUT, the original trs file DID have some bits in it where clearly closing brackets have not been included, so if it's tried to re-import that code, has it broken it in the process?

If anyone can shed light on this please let me know. If not, it's okay - I'll just go with the EXE + TRA file (which has no known problems) but I was hoping to have just the EXE with the translation turned into the default language. And would like to know if the code in trs file is natural or not. If you need other info let me know :) Thanks for your time :)

selmiak

I translated quite some AGS games and never saw code snippets in the translation files. So your export was corrupted already, maybe coming from the scripting. Did you forget to close a say command or a dialoge line? importing it back in will surely give funny results.
Is this over multiple lines in the translation file or on one single line? I see that the quote spans several lines but some editors display texts over multiple lines and still only have a linenumber at the start of this and the next line number right after this.
Have you tried treating it as a single line and just deleting this and then reimporting? this might still shift lines and screw things up.
with which AGS version is this happing?

m0ds

3.2.1. Good points selmiak, thanks. I'd not thought of it like that.

Most of the initial work to get the translation working was shifting a few double spaced lines. What you see above is the exact formatting of the translated trs file. But when it was exported originally (with no french additions) it had the code, and the spacing was exactly the same (as quoted above).

So, you say it's probably not meant to be there, that gives me something to work with. I can go see if there's that error in the dialogue and I'll also just attempt removing all the code and just accounting for it as a single line.

And yes, there are say 5,000 lines in the trs file and 2,000 of them are code, but they are just in two sections amongst the normal translation. In fact, the fact they are "formatted" in the trs file exactly as you see in the editor leaves me to believe you're right. Thanks for offering some advice :)

Khris

I can easily replicate this by removing a quote at the end of a string and updating the translation file. AGS will only save the game before updating the translation, not compile it, so it won't detect missing quotes and keep adding lines and lines of code to the translation, until the next quote or the script ends, I assume.

Since AGS only cares about whether a line is on an even or odd line, you can simply remove all the code from the translation source without breaking it.

m0ds

Cheers Khris. It'll take me half hour to compile it all and try again but I'll let you both know what happens next... many thanks.

Edit: Oh look...

Code: ags

  Display("Who should I give it to?");");


;)

and the other one, clear as day now!

DisplayAt(10, 450, 780, "That sick man... how did he manage to hide all this madness?...");");

Edit I got a successful compile, thanks guys! There was one exception error but AGS still compiled and the game runs. So now for some French peeps to test it I guess and see where things cock up in game...

SMF spam blocked by CleanTalk