Difference between revisions of "Translation Guide"

From Open Surge Engine Wiki
Jump to: navigation, search
(I want to help!)
(File format)
Line 8: Line 8:
 
== File format ==
 
== File format ==
 
Once you open a .lng file, you'll see something like that:
 
Once you open a .lng file, you'll see something like that:
<pre>
+
<pre>// ...
// Meta data
+
LANG_LANGUAGE              "English"
+
LANG_AUTHOR                "Alexandre"
+
LANG_LASTUPDATE            "2009-07-20"
+
LANG_COMPATIBILITY          "0.1.3"
+
  
 +
// Translation metadata
 +
LANG_ID                    "en_US"                  // language code & country according to ISO 639-1 & ISO 3166-1, respectively
 +
LANG_NAME                  "English"                // language name
 +
LANG_AUTHOR                "Alexandre Martins"      // translation author
 +
LANG_LASTUPDATE            "2019-01-11"              // date format: yyyy-mm-dd
 +
LANG_COMPATIBILITY          "0.5.0"                  // required engine version
  
 
// Colors
 
// Colors
COLOR_P1                    "0077ff"
+
COLOR_TITLE                "ff8800"
COLOR_P2                    "ff7700"
+
COLOR_HIGHLIGHT            "ffee11"
COLOR_P3                    "ff0000"
+
COLOR_HUD                  "ffff00"
COLOR_INPUT                "aaaaaa"
+
COLOR_HUDDANGER            "ff0000"
COLOR_SPECIAL              "ffff00"
+
  
 +
// ...
  
// Main menu
+
// Options
MENU_1PGAME                 "1P GAME"
+
OPTIONS_TITLE              "<color=$COLOR_TITLE>OPTIONS</color>"
MENU_CUSTOMQUESTS          "CUSTOM QUESTS"
+
OPTIONS_YES                 "YES"
MENU_TUTORIAL              "TUTORIAL"
+
OPTIONS_NO                  "NO"
MENU_LANGUAGE              "CHANGE LANGUAGE"
+
OPTIONS_GRAPHICS            "GRAPHICS"
MENU_CREDITS                "CREDITS"
+
OPTIONS_FULLSCREEN          "Fullscreen"
MENU_EXIT                  "EXIT"
+
OPTIONS_RESOLUTION          "Screen size"
 +
OPTIONS_RESOLUTION_OPT1    "1X"
 +
OPTIONS_RESOLUTION_OPT2    "2X"
 +
OPTIONS_RESOLUTION_OPT3    "3X"
 +
OPTIONS_RESOLUTION_OPT4    "4X"
  
 
+
// ... the file goes on...
// and the file goes on...
+
 
</pre>
 
</pre>
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:
+
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 Portuguese language file:
  
<pre>
+
<pre>// ...
// Meta data
+
LANG_LANGUAGE              "Español"
+
LANG_AUTHOR                "Lainz"
+
LANG_LASTUPDATE            "2009-07-23"
+
LANG_COMPATIBILITY          "0.1.3"
+
  
 +
// Translation metadata
 +
LANG_ID                    "pt_BR"                  // language code & country according to ISO 639-1 & ISO 3166-1, respectively
 +
LANG_NAME                  "Português (Brasil)"      // language name
 +
LANG_AUTHOR                "Alexandre Martins"      // translation author
 +
LANG_LASTUPDATE            "2019-11-01"              // date format: yyyy-mm-dd
 +
LANG_COMPATIBILITY          "0.5.0"                  // required engine version
  
 
// Colors
 
// Colors
COLOR_P1                    "0077ff"
+
COLOR_TITLE                "ff8800"
COLOR_P2                    "ff7700"
+
COLOR_HIGHLIGHT            "ffee11"
COLOR_P3                    "ff0000"
+
COLOR_HUD                  "ffff00"
COLOR_INPUT                "aaaaaa"
+
COLOR_HUDDANGER            "ff0000"
COLOR_SPECIAL              "ffff00"
+
 
+
  
// Main menu
+
// ...
MENU_1PGAME                "1P JUEGO"
+
MENU_CUSTOMQUESTS          "PARTIDAS"
+
MENU_TUTORIAL              "TUTORIAL"
+
MENU_LANGUAGE              "IDIOMAS"
+
MENU_CREDITS                "CREDITOS"
+
MENU_EXIT                  "SALIR"
+
  
 +
// Options
 +
OPTIONS_TITLE              "<color=$COLOR_TITLE>CONFIGURAÇÕES</color>"
 +
OPTIONS_YES                "SIM"
 +
OPTIONS_NO                  "NÃO"
 +
OPTIONS_GRAPHICS            "GRÁFICOS"
 +
OPTIONS_FULLSCREEN          "Tela cheia"
 +
OPTIONS_RESOLUTION          "Tamanho"
 +
OPTIONS_RESOLUTION_OPT1    "1X"
 +
OPTIONS_RESOLUTION_OPT2    "2X"
 +
OPTIONS_RESOLUTION_OPT3    "3X"
 +
OPTIONS_RESOLUTION_OPT4    "4X"
  
// and the file goes on...
+
// ... the file goes on...
 
</pre>
 
</pre>
  

Revision as of 20:53, 12 November 2019

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, Vim, Programmer's Notepad, or Notepad++. Once a new .lng file has been put in the languages/ directory, the corresponding new translation will be detected automatically.

Also you can use Language Editor: Translate .lng that is an UI to open and edit already created .lng files.

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:

// ...

// Translation metadata
LANG_ID                     "en_US"                   // language code & country according to ISO 639-1 & ISO 3166-1, respectively
LANG_NAME                   "English"                 // language name
LANG_AUTHOR                 "Alexandre Martins"       // translation author
LANG_LASTUPDATE             "2019-01-11"              // date format: yyyy-mm-dd
LANG_COMPATIBILITY          "0.5.0"                   // required engine version

// Colors
COLOR_TITLE                 "ff8800"
COLOR_HIGHLIGHT             "ffee11"
COLOR_HUD                   "ffff00"
COLOR_HUDDANGER             "ff0000"

// ...

// Options
OPTIONS_TITLE               "<color=$COLOR_TITLE>OPTIONS</color>"
OPTIONS_YES                 "YES"
OPTIONS_NO                  "NO"
OPTIONS_GRAPHICS            "GRAPHICS"
OPTIONS_FULLSCREEN          "Fullscreen"
OPTIONS_RESOLUTION          "Screen size"
OPTIONS_RESOLUTION_OPT1     "1X"
OPTIONS_RESOLUTION_OPT2     "2X"
OPTIONS_RESOLUTION_OPT3     "3X"
OPTIONS_RESOLUTION_OPT4     "4X"

// ... 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 Portuguese language file:

// ...

// Translation metadata
LANG_ID                     "pt_BR"                   // language code & country according to ISO 639-1 & ISO 3166-1, respectively
LANG_NAME                   "Português (Brasil)"      // language name
LANG_AUTHOR                 "Alexandre Martins"       // translation author
LANG_LASTUPDATE             "2019-11-01"              // date format: yyyy-mm-dd
LANG_COMPATIBILITY          "0.5.0"                   // required engine version

// Colors
COLOR_TITLE                 "ff8800"
COLOR_HIGHLIGHT             "ffee11"
COLOR_HUD                   "ffff00"
COLOR_HUDDANGER             "ff0000"

// ...

// Options
OPTIONS_TITLE               "<color=$COLOR_TITLE>CONFIGURAÇÕES</color>"
OPTIONS_YES                 "SIM"
OPTIONS_NO                  "NÃO"
OPTIONS_GRAPHICS            "GRÁFICOS"
OPTIONS_FULLSCREEN          "Tela cheia"
OPTIONS_RESOLUTION          "Tamanho"
OPTIONS_RESOLUTION_OPT1     "1X"
OPTIONS_RESOLUTION_OPT2     "2X"
OPTIONS_RESOLUTION_OPT3     "3X"
OPTIONS_RESOLUTION_OPT4     "4X"

// ... 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.

Special characters

You may include special characters in your messages.

Character Effect
\n New line
\" Double quote
\\ Backslash

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 - see Colors for more details). 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_TITLE                 "ff8800"
COLOR_HIGHLIGHT             "ffee11"
LEV_DEMO_3                  "<color=$COLOR_TITLE>Unleash your creativity!</color>\nOne of the key features in Open Surge is <color=$COLOR_HIGHLIGHT>SurgeScript</color>. It's scripting for games! Use it to build anything your imagination can conceive!"

This is the result:

The message displayed in the game

I want to help!

If you enjoy Open Surge and want to contribute by translating it to your language, send your .lng file to Alexandre (see: Contact the developers).

Please observe the following:

  • Test your translation before submitting it to the project!
  • All texts must be rendered correctly (within their graphical boundaries)
    • This requires manual examination of all the texts during gameplay
  • Make sure that all texts are correct (no typos / mistranslations)
  • Finally, please keep the license of the original English translation

We may accept your translation provided that the project hasn't been translated to your language yet. Please note that translators are asked to keep their .lng files up to date. The game is in development and new texts may be included in new versions.

Your help is greatly appreciated!