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.
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?
Not sure why it is not working but change it to use IsTranslationAvailable instead.
if (!Game.IsTranslationAvailable()) {
...
Ah! Thanks, that works.
I had assumed that IsTranslationAvailable() returned TRUE if a translation was... well, available.
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".
Thanks for the explanation, CW!