Localization

It is possible to support multiple languages in Clonk objects and scenarios. To do this, certain components can be loaded language dependantly.

Adaptable Elements

Title.txt
The Title.txt component can be used in scenarios and object folders to define the title for each language.
Each line has a language abbreviation bevore the title. For example:
DE:Angriff der Killerwipfe
US:Attack of the Killer Wipfs
In external language packs the Title*.txt should be at the corresponding directory position (whereas * is replaced with the used language abbreviation), which can contain the title for that language. Here is an example for a TitleFR.txt:
FR:Les wipfes moerderesque attaquent
If an entry for the choosen language is present, the Title entry from the Scenario.txt is replaced by the corresponding name.
Important: No quotation marks and special characters should be used.
Desc*.txt
To customize the description of a scenario language dependant, a Desc*.txt in the scenario has to be present. (The * is a placeholder for the language abbreviation)
Script.c, Teams.txt
In order to insert language-dependant texts into scripts, so-called string tables are used. Instead of the text, only references to it should be inserted into the script. The references are searched in the string table, which should be placed in the same folder as the referencing script and named StringTbl*.txt (where * must be substituted by the language code).
The reference in the script is composed of a name for the string (string-ID), surrounded by dollar signs ("$").
For example:
local Name = "$NameGPS$";
Sets the name of the object definition. See properties. In place of the placeholder NameGPS, the string from the string table is inserted.
Another example:
protected func Activate(object caller)
{
  [$DescActivate$]
  caller->Message("$MsgYourPosition$ %d / %d", caller->GetX(), caller->GetY());
}
In this case, two strings with the names "DescActivate" and "MsgYourPosition" are being inserted.
An appropriate StringTblDE.txt (for German language) could look like the following:
# Beschreibungstexte und Name
NameGPS=Positionierungssystem
DescActivate=Position bestimmen
# Nachrichten
MsgYourPosition=Deine Position ist:
In this object the Activate function has the description "Position bestimmen". Executing it yields a message "Deine Position ist: 252 / 352". The string table also contains two comments starting with a '#'-sign. Those are ignored.
For the sake of completeness, here is a suitable StringTblUS.txt:
# Description texts and name
NameGPS=Positioning system
DescActivate=Tell position
# Messages
MsgYourPosition=Your position is:
This would yield the message "Your position is: 252 / 352", if English language were selected.
PeterW, 2002-04
matthes, 2004-04