Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Rulaman on Sun 17/12/2023 22:29:44

Title: How to set Translation lines from Editor plugin?
Post by: Rulaman on Sun 17/12/2023 22:29:44
Currently I am working on a plugin.

But I have a problem and cannot set the translation lines.

let x = host.CurrentGame.Translations[num]
x.TranslatedLines["MMM37"] <- ret.Text

When I save the game the file is not written.

What am I doing wrong?

Is there another way to set this?

Greetings
Rulaman
Title: Re: How to set Translation lines from Editor plugin?
Post by: Crimson Wizard on Sat 23/12/2023 03:23:33
Hello.

Quote from: Rulaman on Sun 17/12/2023 22:29:44When I save the game the file is not written.

Please clarify,
1. How do you save the game? by using AGS menu, or by some command from plugin?
2. When you say "the file is not written", do you mean that the TRS is not written at all, or that the new translation is not written?

Also, for the record, which version of AGS are you testing against?
Title: Re: How to set Translation lines from Editor plugin?
Post by: Rulaman on Sat 23/12/2023 09:36:20
Sorry for being unprecise.

I test against the version 3.6.1.12 (20. Nov. 2023)
I use the save menu from the editor.

And yes, the trs file is not written (updated)
I tested with the property Modified but that does also nothing.
Title: Re: How to set Translation lines from Editor plugin?
Post by: Crimson Wizard on Sat 23/12/2023 12:33:36
I see now.
AGS Editor does not write TRS files at "save project" command at all. There's no point, as currently you cannot edit them in editor, and users have to edit TRS files themselves in a text editor, where they save it.

Editor itself only ever writes TRS:
* When creating new translation.
* When user clicks on "Update" command on translation item: that scans through whole game and adds new original lines.

Programmatically TRS is written by Translation.SaveData() function call.

So for plugin you probably should do the same: call "host.CurrentGame.Translations[num].SaveData()" (for example).
Title: Re: How to set Translation lines from Editor plugin?
Post by: Rulaman on Sat 23/12/2023 21:14:25
Thanks CW,

silly me does not looked through the available options in the debugger.
(I could slap myself.)

That was it. It makes it so much easier.


Greetings and Thanks
Rulaman