Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Stranga on Mon 05/11/2018 06:51:03

Title: Transalation file only translate menu/GUI text not speech. SOLVED
Post by: Stranga on Mon 05/11/2018 06:51:03
Hey everyone, I am using AGS 3.4.1 and a custom dialogue script. I have a trs file in Spanish and when I test it everything in a GUI or Display"" works fine. However, none of my character speech text is translated at all! I have checked the .trs file for line breaks and there are none. I have change the font of the speech/menu to try and debug this matter and nothing. I am running very low on ideas on what could be causing this issue. If anyone could help it would be greatly appreciated :)

Edit: The fault was I did not compile the translation file and the trs file was corrupted.
Title: Re: Transalation file only translate menu/GUI text not speech.
Post by: Lewis on Mon 05/11/2018 07:48:09
Quotea custom dialog script

Tell us more about this?
Title: Re: Transalation file only translate menu/GUI text not speech.
Post by: Stranga on Mon 05/11/2018 08:02:04
No problem! Also as an update, I recently discovered that in very rare circumstances you will see a very quick glimpse of translated text before changing back to English. It happens with the typewriter effect.

The custom dialogue script uses a GUI label rather than the TextWindowGUI. Also, I have a typewriter effect to go with it. Is there something I need to do in order for this to work correctly?
Title: Re: Transalation file only translate menu/GUI text not speech.
Post by: Crimson Wizard on Mon 05/11/2018 08:17:12
AGS only do proper translation when it has full text. If you do typewriter effect, that means that the label will have partial text most of the time, preventing AGS from finding translation match automatically.

In case like this you should use "GetTranslation" to receive and store a full text in the current language, then run typewriter effect with it. Example:
Code (ags) Select

function RunTypewriterSpeech(String text)
{
    String fulltext = GetTranslation(text);
    // start typewriter with "fulltext"
}
Title: Re: Transalation file only translate menu/GUI text not speech.
Post by: Stranga on Mon 05/11/2018 08:45:28
Although that does make perfect sense, I have noticed that line is already in the script.
Code (ags) Select
function Speak(this Character*, String txt, int speed, int color)
{
  String text = GetTranslation(txt);
// ChangePortrait(chars_setup[this.ID].Portrait);

  if (!color) {color = chars_setup[this.ID].SpeechColor;}
  else
  {
   color = DEFAULT_SPEECH_COLOR;
  }
  lbltext.TextColor = color;
 
String tmp = "";
int text_length = text.Length;
int i = 0;
char curChar;
bool abort = false;
bool speaking = false;
  bool keys;
 
  ShowTextBox();
  Wait(5);
 
  while (i < text_length && !abort )
{
curChar = text.Chars[i];
tmp = tmp.AppendChar(curChar);
lbltext.Text = tmp;
    if (curChar == eKeyPeriod || curChar == eKeyExclamationMark || curChar == eKeyQuestionMark || curChar == eKeyOpenBracket)
{
//     ChangePortrait(chars_setup[this.ID].Portrait);
      speaking = false;
Wait(1);
}
    else if (!speaking && !IsGamePaused())
{
      speaking = true;
    }
   
     Wait(speed); 
     abort = IsKeyPressed(eKeyReturn) || IsKeyPressed(eKeySpace) == true;
     i++;
     aSpeech.Play();
  }
    lbltext.Text = text;
    if (abort || Autotext==false)
    {Wait(7); WaitKey(9000);}
    else
    {WaitKey(60);}
    lbltext.Text = "";
}


Unless there is a fault in this script somewhere? Because it still sin't working. Also this script is above my global script. Could that possibly be the case?