Object Import - Base Texts

Everything in SimuTranslator is considered object, so Simutrans program texts need object stubs created from program strings. Here is a simple script which can convert Simutrans language tab file to the object stubs used by SimuTranslator.

This operation needs to be done only if you have many new program strings to import, or if SimuTranslator database was corrupted for some reason.

Tab to Dat Conversion Script

This is simple script for creating "stub objects" used by SimuTranslator from a Simutrans translation file. This script shall not be used for any other set than "Base Texts".

Download the script.

Parameters

Language

Python; any version > 2.0.

Input

Normal Simutrans base translation file.

Output

Datfile usable by SimuTranslator to generate stub objects (translation texts are not used).

Use

tab-obj.py input_file output_file

Operation

Script skips all comment lines (starting with #). Script skips first three (non-comment) lines of the file - this should be language name, and font definition. If you have older language file with 2 font definitions it is important to remove the second one.

Script has no parity check, so it is important that the tab file contains no errors in the sync - ie. no missing line. You can check if the stub object file is correct by looking at the names - all should be program strings only. Note: since translation texts do not satisfy the criteria for object names, it is highly probable that wrong file will cause errors when importing to SimuTranslator.

Script preserves all extra spaces at the beginning, inside, and at the end of the program strings, but since the used version of MYSQL database engine trims the trailing spaces for VARCHAR data type, it is not possible to use such strings for object stubs (this does NOT apply for the import of the translation texts, all spaces are preserved there).

Once you have the stub objects, you can import them to SimuTranslator using the object import in manage objects menu. Remember to zip it before, SimuTranslator expects zipped file.

When object upload is finished, you can use the tab file to upload the translation texts if needed. Be careful, it is important that you remove the language name from the base translation files, otherwise you will encounter "out-of-sync" problem during text import.