File: Translate.xml

package info (click to toggle)
openclonk 8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 169,520 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (41 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
  SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
  <func>
    <title>Translate</title>
    <category>Script</category>
    <subcat>Strings</subcat>
    <version>5.1 OC</version>
    <syntax>
      <rtype>string</rtype>
      <params>
        <param>
          <type>string</type>
          <name>text</name>
          <desc>String to translate</desc>
        </param>
      </params>
    </syntax>
    <desc>Looks up a text in <emlink href="lang.html">StringTbl??.txt</emlink> of the calling script and returns its translation.</desc>
    <examples>
      <example>
				<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>
      </example>
    </examples>
    <related><funclink>GetTranslatedString</funclink></related>
  </func>
  <author>Isilkor</author><date>2009-11</date>
  <author>Newton</author><date>2011-06</date>
</funcs>