Loading...
 

Translation

Translationlink


This is a technical page, covering how Simutrans handles the translation of texts; it is not intended for players, but for developers.



Simutrans can be used with a lot of languages, using conversions based on the international language codes. Any language code can be added to the Simutrans configuration, even non-existent two letter codes. Each code needs to have a translation for each text used; if you can help see Translation and Texts. Non-existent two letter codes might not work with SimuTranslator.

Technical Backgroundlink

The texts used in Simutrans are distributed over several files and folders. The program has its own output texts, called base texts, and each pakset also provides texts (e.g. road types, signal types, building names), called pak texts. Both kinds of internal texts are expressed in the code in only one language (mostly English nowadays, but a lot are in German, due to the program’s origin). Their translations, what is seen on the screen, may not be nicely formatted, or up-to-date regarding their meaning within the context of the game.

These internal texts need to be replaced by the language that the player wants to use (even if it is English or German), which is done by using the mapping (from internal texts to a certain language) contained in the file <language code>.tab - one file for the base texts (in simutrans/text), one for the pakset texts (in simutrans/<pak-name>/text). The program reads the text translations from these files, converting the internal texts into the language chosen by the player using files specific to that language.

Additional help texts are held in single files and are displayed when the player clicks the ? button in a window. Refer to the Translation and Texts page for more details.

Internal Text valueslink

To see the internal texts in the game itself (so you can look for them in .tab files and SimuTranslator), create a file simutrans/text/zz.tab (zz being an unused language code in Simutrans) containing only these lines (you can, of course, exchange the separator definitions):

ZZ_System
PROP_FONT_FILE
Prop-Latin1.bdf
SEP_THOUSAND
,
SEP_FRACTION
.


There is no need to create directory simutrans/text/zz as help texts are be read from the en directory if not found.

You can then select the ZZ_System language in the options screen. Any open windows will keep the same text they opened with, but new windows will use the new language, i.e. the untranslated text as no translations exist.

City nameslink

Simutrans can create city names two ways:
  • If there is a citylist_xx.txt file for the chosen language, city names are read from this file.
  • Otherwise random city names are created from the syllables given in <language>.tab

Currently there is only one citylist per language used i.e. for english, citylist_en.txt is used. A citylist in <pak_name>/text/ is used instead of a citylist in text/; different paksets can have different citylists. There are some additional citylist files supplied, e.g. citylist_en_au.txt for Australian city names and citylist_de_at.txt for Austrian city names. To use one of these lists, rename or copy the citylist to the folder text/ or to your pak-files e.g. pak/text/ using the name citylist_en.txt or citylist_de.txt (matching your language code).

If you don’t want Simutrans to use the city name lists, delete or rename the file for your language; Simutrans will generate random city names. The <language>.tab file holds several translations for the start and end of a city name; %0_CITY_SYLL for the first start text and &0_CITY_SYLL for the first end text. Simutrans will name cities by selecting a random start and a random end and joining them. The texts are numbered from %0 through %9, %A through %Z, although some are not translated and do not appear in the translation file.

Translation in the codelink

The method responsible for performing the translation is translator::translate(). The internal text is passed as a parameter to the method. Sometimes that parameter is a literal string, and sometimes it is a variable (of type string). Developers are encouraged to use this method instead of coding the string that is to be displayed to make use of the translation capability and to make Simutrans more accessible across the world.

Also See:link

Simutrans Translation Rules
Rate this page:

Contributors to this page: Frank , SimonSmall , IgorEliezer and system .
Page last modified on Monday August 15, 2016 23:20:08 CEST by Frank.

Online Users

14 online users

Newest Forum Posts

No records to display