Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Joe on Mon 18/05/2009 20:02:50

Title: BUG:(AGS 3.1.2) Translations
Post by: Joe on Mon 18/05/2009 20:02:50
I made a game using AGS 3.1.2 and then I translated it, when I tested the game with the traslation it just worked with Display function and some other, so I had to make english the default language of my game...

Sorry if this has already been said.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Mon 18/05/2009 20:03:53
You'll have to be more explicit about the problem, there are no known issues with translations that I'm aware of.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Joe on Mon 18/05/2009 20:58:33
Ok. I translated my Spanish game into English and compiled the translation source. Then I selected the English translation in the winsetup.exe and played my game. But most of the texts were still in Spanish.
I really don't know why did this happen but I can sure you I used the source correctly and as I've seen in this game: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37800.0 it's not only my problem so I decided to post it.

Joe.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Mon 18/05/2009 23:37:43
Can you give an example of one scripting line where it doesn't translate the text?

In the Alien: Puzzle Invasion game that you linked to it looks like lots of the text is part of the background image (which wouldn't be translated for obvious reasons).
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: GarageGothic on Tue 19/05/2009 00:20:00
Are you only using the standard Say, Display, Label.SetText and similar commands? If you're using a module or other custom functions that somehow parse the String before displaying it (for instance I have code that linebreak Strings and then call DrawString on the individual lines)? If so, you have to replace the original String with the translated version using  "GetTranslation(string original)" before changing it.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Joe on Tue 19/05/2009 12:35:19
QuoteCan you give an example of one scripting line where it doesn't translate the text?

void UpdateState(){

  if(life<=100)lVida.TextColor=2016;
  if(life<=80)lVida.TextColor=52576;
  if(life<=50)lVida.TextColor=54272;
  if(life<=20)lVida.TextColor=63488;
  if(life<=0)Vida=0;
  if(life>100)Vida=100;
  lLife.Text=String.Format("VIDA: %d %",Vida);
  lBullets.Text=String.Format("BALAS: %d/%d",Balas, TotBalas);
  if(life<=0){
    Wait(20);
    Display("Joseda y sus secuaces han podido contigo");
    RestartGame();
  }
 
}


Those lines are not translated...

QuoteIn the Alien: Puzzle Invasion game that you linked to it looks like lots of the text is part of the background image (which wouldn't be translated for obvious reasons).
Hmm I see. Then it's just my problem again

Quote
Are you only using the standard Say, Display, Label.SetText and similar commands? If you're using a module or other custom functions that somehow parse the String before displaying it (for instance I have code that linebreak Strings and then call DrawString on the individual lines)? If so, you have to replace the original String with the translated version using  "GetTranslation(string original)" before changing it.

Hmm you can see it in my code, anyway I think that's the reason it's not working...

However I don't know what you really mean by replacing the original String with the translated version[...]
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Khris on Tue 19/05/2009 13:09:27
Try this:

  lLife.Text = String.Format(GetTranslation("VIDA: %d %"), Vida);
  lBullets.Text = String.Format(GetTranslation("BALAS: %d/%d"), Balas, TotBalas);


I'm not sure if this is the way GetTranslation is supposed to be used here though.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Tue 19/05/2009 19:22:02
Quote from: Joe Carl on Tue 19/05/2009 12:35:19
  lLife.Text=String.Format("VIDA: %d %",Vida);
  lBullets.Text=String.Format("BALAS: %d/%d",Balas, TotBalas);

Can you post the lines from your translation source file that attempt to translate these texts? (ie. both the Spanish and English versions)?

Did you leave all the %d and % signs intact in the English translation?
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Joe on Tue 19/05/2009 19:54:35
Quote from: Pumaman on Tue 19/05/2009 19:22:02
Quote from: Joe Carl on Tue 19/05/2009 12:35:19
  lLife.Text=String.Format("VIDA: %d %",Vida);
  lBullets.Text=String.Format("BALAS: %d/%d",Balas, TotBalas);

Can you post the lines from your translation source file that attempt to translate these texts? (ie. both the Spanish and English versions)?

Did you leave all the %d and % signs intact in the English translation?


Here it is:

VIDA: %d %
LIFE: %d %
BALAS: %d/%d
BULLETS: %d/%d


-----

I'll try what Khris said as soon as I can
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Thu 21/05/2009 22:29:19
Hmm, that should work... String.Format should automatically apply the translation. I'll see if I can replicate it.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Dualnames on Tue 26/05/2009 10:29:21
I found a crash thing. I was going to make a translation into a default language but the engine (3.1.2) won't let me make it into default and instead appears this error message. Apparently something is messed up. Thing is anyone care to find it here?


http://ledzepforever.googlepages.com/proofread.trs

Or at least tell me what to look for. :(
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Tue 26/05/2009 18:01:26
Well, what's the error message?

If extra lines have been added to the file by hand it's possible there is a duplicate line in there, which I think I have seen cause errors in the past.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Dualnames on Wed 27/05/2009 09:44:37
Quote from: Pumaman on Tue 26/05/2009 18:01:26
Well, what's the error message?

If extra lines have been added to the file by hand it's possible there is a duplicate line in there, which I think I have seen cause errors in the past.


Ah, crap I thought I posted the message..

(http://i133.photobucket.com/albums/q53/JustLedZep/untitled-4.png)
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Wed 27/05/2009 18:34:09
Thanks. It looks like this is a bug in the AGS Editor if two different source lines in the file map to the same translation.

For example, in this file there is:
"Heart Of Gold" -> "Heart Of Gold"
"Heart of gold" -> "Heart Of Gold"
and probably others too.

I'll fix it in a future version.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Dualnames on Fri 29/05/2009 10:24:33
Quote from: Pumaman on Wed 27/05/2009 18:34:09
Thanks. It looks like this is a bug in the AGS Editor if two different source lines in the file map to the same translation.

For example, in this file there is:
"Heart Of Gold" -> "Heart Of Gold"
"Heart of gold" -> "Heart Of Gold"
and probably others too.

I'll fix it in a future version.

Seems I can't finish the game if you don't. Well, ok, no worries, thanks for the support. It's really appreciated.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Leon on Fri 29/05/2009 13:04:29
Quote from: Dualnames on Fri 29/05/2009 10:24:33
Seems I can't finish the game if you don't. Well, ok, no worries, thanks for the support. It's really appreciated.

What happens when you 'manually' correct the lines as if they were original? So move the translated line one line up and leave the one below it blank.. Is that maybe a workaround for the time being? Just act as if they don't need to be translated?

Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Dualnames on Fri 29/05/2009 13:05:50
Quote from: Leon on Fri 29/05/2009 13:04:29
Quote from: Dualnames on Fri 29/05/2009 10:24:33
Seems I can't finish the game if you don't. Well, ok, no worries, thanks for the support. It's really appreciated.

What happens when you 'manually' correct the lines as if they were original? So move the translated line one line up and leave the one below it blank.. Is that maybe a workaround for the time being? Just act as if they don't need to be translated?



I might however misplace a line.. and then cause more chaos.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Sektor 13 on Sun 31/05/2009 20:55:58
Hey, I'll use this thread.
I tried to compile new translation but i get the following mesasge:

--------------------------------------------------------------------------------------------------
Error: Input string was not in a correct format.
Version: AGS 3.1.0.59

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at AGS.Types.Translation.ReadOptionalInt(String textToParse)
   at AGS.Types.Translation.ReadSpecialTags(String line)
   at AGS.Types.Translation.LoadData()
   at AGS.Editor.Components.TranslationsComponent.CompileTranslation(Translation translation, CompileMessages errors)
   at AGS.Editor.Components.TranslationsComponent.CommandClick(String controlID)
   at AGS.Editor.GUIController._mainForm_OnMenuClick(String menuItemID)
   at AGS.Editor.ProjectTree.ContextMenuEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
-------------------------------------------------------------------------------

What could cause this kind of a problem ?
I got some older transaltion file that works fine...
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Sun 31/05/2009 23:05:47
Quote from: Sektor 13 on Sun 31/05/2009 20:55:58
Hey, I'll use this thread.
I tried to compile new translation but i get the following mesasge:

The special #NormalFont and #SpeechFont lines must be set to a font number. If you've changed them in this translation file to have a font name, or something that isn't a font number, then this error could result.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Dualnames on Sun 31/05/2009 23:07:22
CJ we're going to trace the problem with leon, so when we do we'll post it here, if that's ok.
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Sektor 13 on Mon 01/06/2009 14:50:40
No extra commands were used (speechfont...) only text translation..


edit: I found it, there is a typo under //#NormalFont as the CJ suggested...

thanx
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Sat 08/08/2009 15:56:11
Quote from: Joe Carl on Tue 19/05/2009 12:35:19
  lLife.Text=String.Format("VIDA: %d %",Vida);
  lBullets.Text=String.Format("BALAS: %d/%d",Balas, TotBalas);

I tried this and it worked fine for me. String.Format should definitely translate those lines if they're in the .TRS file. Did you manage to solve this in the end?
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Joe on Thu 13/08/2009 11:22:39
No I didn't, but you mean it should work in AGS 3.1.2? I really thought it was a bug you'd fix in a future version as you said
Title: Re: BUG:(AGS 3.1.2) Translations
Post by: Pumaman on Sat 15/08/2009 14:18:04
No, the bug I was talking about fixing was the one that Dualnames reported.

I haven't been able to reproduce your problem ... could you upload something that demonstrates the problem?