(Game.TranslationFilename == "") Not working any more?

Started by Ali, Fri 14/04/2017 15:06:02

Previous topic - Next topic

Ali

Hello!

I'm updating Nelly Cootalot: Spoonbeaks Ahoy using AGS 3.4.0. There are lots of scenes where I have to switch objects off or on based on the current translation.

Code: ags

if (Game.TranslationFilename == "") {
  oSp1.Visible=false;
  oFr1.Visible=false;
  oGe1.Visible=false;
  oPo1.Visible=false;
  oF1.SetView (54);
  oF1.Animate (0,  3,  eRepeat,  eNoBlock);  
  }
  
else if (Game.TranslationFilename == "Nelly_Spanish") {
  oSp1.Visible=true;
  oFr1.Visible=false;
  oGe1.Visible=false;
  oPo1.Visible=false;
  oF1.SetView (93);
  oF1.Animate (0,  3,  eRepeat,  eNoBlock);  
  }


The other translations work (Spanish, etc.), but the script for no translation file (Game.TranslationFilename == "") doesn't happen. The same script works back in v3.2.1, but it doesn't work in 3.4.0. Has something changed?

dayowlron

#1
Not sure why it is not working but change it to use IsTranslationAvailable instead.

Code: ags

if (!Game.IsTranslationAvailable()) {
    ...
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Ali

Ah! Thanks, that works.

I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.

Crimson Wizard

#3
That's right, something wrong is there, but I cannot tell when it became so, haven't had time to investigate yet.

Manual states that Game.TranslationFilename should return empty string for default translation, but currently it returns "Default".

UPD: This was broken about 1.5 years ago, since AGS 3.3.5. Until fixed the workaround is to compare versus "default" string.
UPD2: In fact, correct workaround is to compare to both (OR-ing two conditions), because if fixed, it will return to "" again.

Quote from: Ali on Fri 14/04/2017 16:42:49
I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.
Yes, the name of the function may be misleading. It really means "is translation loaded".

Ali


SMF spam blocked by CleanTalk