Difference between revisions of "Localization"

From Serious Sam Wiki
Jump to: navigation, search
Line 78: Line 78:
{{box| Note that we are working on a system to support languages through Workshop without requiring this manual step. }}
{{box| Note that we are working on a system to support languages through Workshop without requiring this manual step. }}

Revision as of 03:52, 5 November 2012

This document describes the structure of localization files for Serious Engine games, and how to make your own translations into new languages, or how to edit the existing ones.

File Format

Localization in most newer Serious Engine games (from Serious Engine 2.0 onwards), is done via "translation table" files. Such a file bears a .tbl extension and looks like this:

0_01_CairoSquare.Name=Summer in Cairo
Simulation.UnableToLoadDamagedGame=Unable to load saved game.\nSaved game appears to be damaged.
DeathMessage.HarpyPunch=%1 was beaten by a Scythian Harpy.
ObjectActionMessage.UseButtonToEnter=Press {plcmdUse} to enter

This file is a normal text file in UTF-8 encoding and you can open it in most modern text editors.

IMPORTANT: This file must be saved in UTF-8 charset. If it is not, the game won't display special characters like accents, umlauts and similar correctly! A recommended free application that can handle it correctly is Notepad++

The number in the first row is the number of strings in the file. Normally, when translating to another language, you don't need to touch that. But just that you know that if the file doesn't work correctly, or reports some errors, you should make sure this matches.

Table Contents

Each line of the file specifies one string, and consists of the following elements:

  1. String identifier - The text to the left of the equals sign ("="). This is what the game uses to find the needed string NEVER translate that!
  2. The equals sign ("="). - Don't touch that either. Don't add spaces before or after it.
  3. The actual string contents. - This is everything to the right of the equals sign. This is what you translate.

In the actual string contents, you will sometimes find some strange symbols. Here is what they do:

\n newline Each of these break the text into a new line. If you check your translated text in the game first, and you are _sure_ that it would be better if you change the line breaks, then do it. But in general, you should generally not touch those.
 %1 %2 %3 ... inserted elements Numbers preceded by a percent sign are used by the game to insert some dynamic elements into the string. You must make sure that your translated string has exactly the same inserts as the original string. If you have less or more, the string will not be outputted correctly. You may (and should - if appropriate), change the order of insertion, to match different ordering of words in different language.
{plcmdUse} input bindings Names of input commands inside curly braces are used by the game to insert the current binding for some command into the string. You must make sure that your translated string has exactly the same bindings as the original string, and that you do not change anything in them. Note that this is a slightly older system, and we are trying to phase them out in favor of numeric insertions, but there are still a lot of leftovers in the code.

Location on Disk

Nominally, translation tables are located in the root of localization folder for the corresponding language, in the "Locales/" folder of the current game content. So e.g. English and German folders for Serious Sam 3 are respectively:


Note the 3-letter language abbreviations ("enu" and "deu" correspond to "English-US" and "Deutch"). These abbreviations are from Windows Language Table. Please use the appropriate 3-letter code from that table for your language.

Working with .gro Files

Normally, you can just create files on disk in the corresponding folder. However, the game expects final content to be packed in .gro files. To learn how to do that, please see [SED3/Packing_Content_for_Distribution]. Once you pack it, you may want to distribute it over the Steam Workshop. See [SED3/Steam Workshop] for instruction on how to do it.

When you are creating a new language, you will need to take the original English text from the game's shipped .gro files, copy that into your folder, and translate. Note that there will be multiple .gro files due to the way the patching system works. To be sure you have the latest file, you should take the one from the latest .gro file that has the appropriate file.

Note that some DLCs, like Jewel of the Nile for Serious Sam 3, have their own localization in a separate table. So, while "translation_All.tbl" has all translations for the base game, there is also "translation_DLC_Sam3Extended.tbl" with those texts that appear only in the DLC.

Using Custom Languages in the Game

While the official languages are selectable from the Steam Languages tab for the game, for a custom language you need to specify it manually, like this:

  • In Steam Library', right-click on the game,
  • choose Properties,
  • in the General tab, click on Set Launch Options...
  • type the following:
+locale "xyz"

(Where "xyz" is the three letter code for your language)

To undo this change, enter just empty quotes ("") instead of the language code.

Note that we are working on a system to support languages through Workshop without requiring this manual step.