You are here

Localisation documentation

I am revising Simile with the intention that all translatable text appears in messages.tcl. First step is to get rid of the text objects still included in the Prolog executable as these are inaccessible to would-be translators until they are used.

Here is the plan! jaspert)

The Tcl files in Simile (.tcl extension) are found in the Run directory under the install directory, and in the IOTools directory and its subdirectories. Within these files you can grep for calls to the tr. function. The function itself is defined in Run/language.tcl. The version currently in use just returns its argument unchanged.

To make a translated version, the tr. function should return the localized version of any string. For example, this would do English to French:

proc tr. {Eng} {

set listEng [list Hello {How are you?} Please Thankyou Goodbye]

set listFr [list Bonjour {Comment allez-vous?} {S'il vous plait} Merci {Au revoir}]

set index [lsearch $listEng $Eng]

if {index==-1} {return $Eng} else {return [lindex $listFr $index}


Note that if the string is not found, the argument is returned unchanged as a fail-safe.

Simple! All you have to do is find out which strings you need to translate. Most calls to tr. are in messages.tcl, which uses keys to find strings for queries generated in other parts of Simile. But there are calls to tr. in a lot of the Tcl files. You should grep for these and provide translations of the argument strings. Where the argument is a variable which has been defined somewhere else, we will include a comment starting "TRANSLATOR" and giving the values the argument can have at that point, so you can make a complete list of possible arguments for which to provide translations.

Note that strings to be translated can contain references of the form %1$s. These are where references will be plugged into the string, usually captions of model components or other labels supplied by the modeller. The translated string should contain the reference unchanged but possibly in a new position. e.g., if %1$s is a colour, then the English {The %1$s cat} translates to the French {Le chat %1$s}. TRANSLATOR comments will be added to indicate what sort of reference to expect in each case. If it has a d rather than an s at the end, it is a whole number.

Please ask any questions here!