Localization support

WME supports localization (i.e. translating your game into different languages) using two basic principles: the string table and multiple packages.

String tables

The string table is a simple text file, which should ideally contain all the localizable in-game texts, such as captions, talk subtitle, GUI labels and others. The string table contains the dictionary of terms in the following format:

Each line of the string table file contains one term, formed by a unique identifier, a tab character and the actual text. For example:

SYSENG0001	Game settings
SYSENG0002	Display
SYSENG0003	Sound
SYSENG0004	Use hardware acceleration
SYSENG0005	Display device:
SYSENG0006	Colors:
SYSENG0007	Run in window
Now, all the texts used throughout the game need to be written down in a special format, like this:

/syseng0001/Game settings

At runtime, the engine extract the identifier and the text itself. It then searches the string table for an entry with the same identifier, and if it's found, it will be used instead. That way you can have the original texts written directly in your scripts (and other game files) and they will only be replaced if there is a string table present.

Strings written in this "localizable" format are automatically translated on most occasions (for example when calling the Talk() method, you can pass the text in this format and the character will automatically say the translated line). But sometimes it's necessary to explicitly translate some text. For this purpose use the Game.ExpandString() method which receives the original text and returns its translated version.

For automatic generation of string tables from your game source files, use the String Table Manager utility.

References from one string table entry to another

String table entries can recursively reference other entries as well. That's useful if you need multiple string table entries to reference the same text. In that case, use the following syntax:

SYSENG0001	Game settings
SYSENG0008 /SYSENG0001/

Now both SYSENG0001 and SYSENG0008 strings reference the text "Game settings" and translators only need to edit the text once.

Automatically locating speech files

String table IDs are also used to automatically locate speech sound files corresponding to each line. By default, WME looks for speech files in a "speech" directory, but you can set other directories using the Game.AddSpeechDir() method.

For example, if your string table contains line:

STR0123 Hi, I'm Bob. How are you?

The corresponding speech file should be named "str0123.ogg". If you copy this file to the "speech" directory, WME will play the sound automatically when the above line is referenced in any Talk() command.

Unicode support

The string tables are not limited to standard ASCII texts, they can contain Unicode characters, encoded in UTF8 format. That way you can translate your game to literally any language, including Asian and other "double-byted" languages. There are some prerequisites for using UTF8 string tables, though:

Please note that WME does NOT support Unicode files, only files saved in UTF8 format.

Right-to-left reading order support

To enable support for right-to-left reading order (used by Arabic and Hebrew) use the Game.TextRTL attribute. Note that you must use TrueType fonts for this to have any effect. Unfortunately you cannot use this attribute to enable right-to-left layout for the initial engine settings window, because it's displayed before any script is executed. Therefore it's possible to enable right-to-left text directly in the string table (similarly to automatic UTF-8 detection in string table). To enable right-to-left support, add the following directive to the string table:

@right-to-left

 

Language packages

But localization isn't limited to texts. Your localized version can have different fonts (using a different codepage), some part of the graphics may need to be changed, or you can have different sound. For that WME allows you to divide your game resources into multiple "packages". You can then move all the localizable resource into a separate package and manipulate is safely independently on the rest of the game.  See the Packages and file system chapter for more details on game packages.