Translate

Category: Script / Strings
Since engine version: 1.0 OC

Description

Looks up a text in StringTbl??.txt of the calling script and returns its translation.

Syntax

string Translate(string text);

Parameter

text:
String to translate

Example

Assuming the StringTblUS.txt of a clonk looks like this:
MsgOnFire0=Aaaa, I am burning!
MsgOnFire1=Waaah, whats this?!
MsgOnFire2=Oh god, I am on fire!
MsgOnFire3=Oops, I dropped my lighter!
With Translate(), the string id that should be displayed can be constructed during runtime:
func Incineration()
{
	Message(Translate(Format("MsgOnFire%d", Random(4)))));
}
When the clonk catches fire, the engine calls Incineration() in the clonk and in this example, one of the four above messages is displayed at random.
See also: GetTranslatedString
Isilkor, 2009-11
Newton, 2011-06