Translation Guide

From Open Surge Wiki
Revision as of 23:25, 13 January 2010 by Alexandre (Talk | contribs) (Created page with '== Introduction == Translations are '''language files''' located in the languages/ folder. A language file is a simple text-based file with the .lng extension. You may open it us…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Translations are language files located in the languages/ folder. A language file is a simple text-based file with the .lng extension. You may open it using a simple text editor like Notepad++. Once a new .lng file has been put in the languages/ directory, the corresponding new translation will be detected automatically.

As you'll see in this article, translating the game to other languages is a very straightforward process.

File format

Once you open a .lng file, you'll see something like that:

# Meta data
LANG_LANGUAGE               English
LANG_AUTHOR                 Alexandre Martins
LANG_LASTUPDATE             2009-07-20
LANG_COMPATIBILITY          0.1.3


# Colors
COLOR_P1                    0077ff
COLOR_P2                    ff7700
COLOR_P3                    ff0000
COLOR_INPUT                 aaaaaa
COLOR_SPECIAL               ffff00


# Main menu
MENU_1PGAME                 1P GAME
MENU_CUSTOMQUESTS           CUSTOM QUESTS
MENU_TUTORIAL               TUTORIAL
MENU_LANGUAGE               CHANGE LANGUAGE
MENU_CREDITS                CREDITS
MENU_EXIT                   EXIT


# and the file goes on...

This is the English language file. It's a list of key/value pairs, each per line. The first word of the line is the key and the text that secedes it is the value. Lines starting with # are comments (meaning that they're ignored by the game engine).

Now, take a look at the Spanish language file:

# Meta data
LANG_LANGUAGE               Español
LANG_AUTHOR                 Lainz
LANG_LASTUPDATE             2009-07-23
LANG_COMPATIBILITY          0.1.3


# Colors
COLOR_P1                    0077ff
COLOR_P2                    ff7700
COLOR_P3                    ff0000
COLOR_INPUT                 aaaaaa
COLOR_SPECIAL               ffff00


# Main menu
MENU_1PGAME                 1P JUEGO
MENU_CUSTOMQUESTS           PARTIDAS
MENU_TUTORIAL               TUTORIAL
MENU_LANGUAGE               IDIOMAS
MENU_CREDITS                CREDITOS
MENU_EXIT                   SALIR


# and the file goes on...

As you can easily notice, only the values of each key/value pair have been translated.

Special features

Constants

Each key/value pair defines a constant. In the examples above, MENU_LANGUAGE stands for CHANGE LANGUAGE (in English) or IDIOMAS (in Spanish). You can obtain the corresponding value for the key MENU_LANGUAGE by writing $MENU_LANGUAGE.

Color tags

Text written inside a <color=RGB_HEX_CODE> ... </color> tag will be colored when displayed to the user. RGB_HEX_CODE is the hexadecimal RGB code of the color you want to get (so, for example, ff0000 is red). You don't really need to know the fancy details, but it's good to know that this feature exists.

You can also combine color tags with constants. Let's say that you have the following key/value pairs somewhere in your translation file:

COLOR_INPUT                 aaaaaa
COLOR_SPECIAL               ffff00
TUTORIAL_2_TITLE_2          SPINDASH
TUTORIAL_2_MSG_2            Do you know the <color=$COLOR_SPECIAL>spindash</color> move? Hold <color=$COLOR_INPUT>DOWN</color>, press <color=$COLOR_INPUT>JUMP</color> and then release the <color=$COLOR_INPUT>DOWN</color> button.

This is the result:

The message displayed in the game

I want to help!

If you want to help the game by translating it to your language, just send us your .lng file. Please note that translators must keep their .lng files up to date! The game is still in development and new texts may be included anytime.

See also: Job Positions