2010-08-22 13:13:17 +00:00
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
< !DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
2009-11-12 15:57:37 +00:00
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs >
<func >
<title > Translate</title>
2010-08-22 13:13:17 +00:00
<category > Script</category>
<subcat > Strings</subcat>
2011-06-30 10:52:55 +00:00
<version > 5.1 OC</version>
2009-11-12 15:57:37 +00:00
<syntax >
<rtype > string</rtype>
<params >
2010-08-22 13:13:17 +00:00
<param >
<type > string</type>
<name > text</name>
<desc > String to translate</desc>
</param>
2009-11-12 15:57:37 +00:00
</params>
</syntax>
2010-08-22 13:13:17 +00:00
<desc > Looks up a text in <emlink href= "lang.html" > StringTbl??.txt</emlink> of the calling script and returns its translation.</desc>
2009-11-12 15:57:37 +00:00
<examples >
<example >
2011-06-30 12:23:24 +00:00
<text > Assuming the StringTblUS.txt of a clonk looks like this:</text>
<code > MsgOnFire0=Aaaa, I am burning!
MsgOnFire1=Waaah, whats this?!
MsgOnFire2=Oh god, I am on fire!
MsgOnFire3=Oops, I dropped my lighter!</code>
<text > With Translate(), the string id that should be displayed can be constructed during runtime:</text>
<code > func Incineration()
{
<funclink > Message</funclink> (Translate(<funclink > Format</funclink> ("MsgOnFire%d", <funclink > Random</funclink> (4)))));
}</code>
<text > 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.</text>
2009-11-12 15:57:37 +00:00
</example>
</examples>
2017-05-07 18:25:03 +00:00
<related > <funclink > GetTranslatedString</funclink> </related>
2009-11-12 15:57:37 +00:00
</func>
2010-08-22 13:13:17 +00:00
<author > Isilkor</author> <date > 2009-11</date>
2011-06-30 12:23:24 +00:00
<author > Newton</author> <date > 2011-06</date>
2009-11-12 15:57:37 +00:00
</funcs>