how to use 'GetTranslation' with 'Substring' and 'Append'? (SOLVED)

Started by EnterTheStory (aka tolworthy), Sun 08/03/2009 23:37:11

Previous topic - Next topic

EnterTheStory (aka tolworthy)

I'm using a translation source, but my characters still speak English.

EDIT: I guessed the wrong problem - see later answer.

[deleted code]

GarageGothic

Where did you try putting GetTranslation? It should work if you put:

Code: ags
bigString = GetTranslation(bigString);


as the first line of the function.

EnterTheStory (aka tolworthy)

EDIT:

I'm getting somewhere now.

After much experimenting, it seems that I was wrong. The problem seems to be in the translation file somewhere. I tried a one-line translation source, and it worked perfectly. Then I tried the original full translation (before I added new lines) and AGS complains that it has an uneven number of lines. I can't see where the uneven lines are (the text file is 2.5 MB long) but I'll go and hunt them down.

GarageGothic

I don't remember if String parameters are write protected, but just to make sure you could try creating a temp String, do the "tempString = GetTranslation(bigString)" and then use tempString as the source for the rest of the code.

Also make sure that the content of bigString didn't change since you created the translation source. How long is bigString, by the way? I seem to remember translations having trouble with too long Strings.

Edit: Wrote before I saw your edit. Good luck with the bug hunt!

EnterTheStory (aka tolworthy)

Quote from: GarageGothic on Mon 09/03/2009 00:13:12How long is bigString, by the way? I seem to remember translations having trouble with too long Strings.
Thanks for the suggestion. It might be that. Many of my Strings are pushing 500 characters, and the translation (to Dutch) will be longer. But in tests I managed to show 1000 character lines, so I hope that's not the problem.

EDIT NEXT MORNING:

Found the problem. When I add a line of comment above some complex code I often add a blank line to make it readable. Adding blank lines to the translation source is a Very Bad Idea, I now realize. Problem solved.

SMF spam blocked by CleanTalk