Any workaround to translate long appended texts?

Started by fratello Manu, Mon 22/11/2021 14:55:54

Previous topic - Next topic

fratello Manu

Hi everyone,

I just read on the manual (..too late!  :P)

QuoteWhile most in-game text is translated automatically, there are a few instances when this is not possible. These are when a script uses functions like Append to build up a string, or CompareTo to check some user input. In these cases, you can use the GetTranslation function to make it work.

is there any workaround for this? I have a game with a huge amount of long strings and I obtained the text merging several lines with the .Append function. And (as I discovered just after) they are not automatically translated when calling Game.ChangeTranslation("language"). Eg:

Code: ags

  String sText = ""; 

  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla");


and it is not easable using the GetTranslation every time, because of the huge amount of text

So I tried using the standard C# operator + to concatenate the string, avoiding the .Append function, but in AGS script is not available (that's why probably I wrote all these .Append  :P)

Any suggestion?
Thanks!

Crimson Wizard

Quote from: manu_controvento on Mon 22/11/2021 14:55:54
and it is not easable using the GetTranslation every time, because of the huge amount of text

Could you elaborate on this, why GetTranslation is difficult to use?

fratello Manu

Example:

  String sText = "";

  sText = sText .Append(this is a very long text and in a future version of the game it may change[");
  sText = sText .Append("and this one too[");
  sText = sText .Append("to mention this one, it will take you years to read it[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla[");
  sText = sText .Append("bla bla bla bla");

if I should use the GetTranslation every time, I should call something like .GetTranslation("this is a very long text and in a future version of the game it may change[");
So the first problem is that it's very uncomfortable calling this for every long dialogue or description in game; but most of all if I decide lately to modify texts and dialogues, I also have to open translation files and put hte new exact translatable sentence, and so on...

anyway, it's not a problem, I'll manage long appended texts out of the translation files system, I just wanted to know if someone already faced and solved the problem

Have a nice day everyone!

Crimson Wizard

#3
Something I have not tested myself:

1) Do GetTranslation() only on the final string result, after all the appends.
2) in TRS have the full line as long as it takes, because TRS/TRA files don't have these limits afaik.

I suppose this could work, because engine cares only which line is sent to GetTranslation, and which line is in TRA.

But even if this works, idk how more or less convenient this may be though.

SMF spam blocked by CleanTalk