How to set Translation lines from Editor plugin?

Started by Rulaman, Sun 17/12/2023 22:29:44

Previous topic - Next topic

Rulaman

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
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#1
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?

Rulaman

#2
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.
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

Crimson Wizard

#3
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).

Rulaman

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
Zak: Komm mit mir Sushi.
Zak: Come with me Sushi.

SMF spam blocked by CleanTalk