SpaceEngine stores all language-related files in the folder locale/. Full localization consists of 5 files. The name of each file begins with short language abbreviation, like eng, rus, ger, etc. This abbrevation is shown in the change language menu and used by SE to recognize all files, associated with this localization. In this tutorial I will use abbreviation loc, but you must replace it with your own one. The localization files are next:
[Required] The script file with translations of all text strings of the SE interface: loc-gui.cfg
[Required depending on your language] The font texture winXXXX-font.png
[Required depending on your language] The font configuration script winXXXX.cfg
[Optional] The main menu texture loc-menu.png
[Optional] The in-game wiki database script loc-db.cfg
The translations script
loc-gui.cfg
This file is the main file of localization. It is a text file with this structure:
The first two parameters is the name of the font config script and font texture (look the next paragraph). After them there are many-many rows, consists the default SpaceEngine's GUI string in English and your translation for them into your language. The file should be in your national code page format (not Unicode). You may use text editors like Notepad++ which automatically choose the proper code page.
It is possible to miss some translations - SE will show default English string for them. If you have untranslated strings, SE will print warnings in the log (system/se.log), and in the in-game console:
Code
WARNING: loc.SetLocalization(): Translation not found for some strings. -------------------- "Aurora" "Clouds 0" "Clouds 1" "Clouds 2" "ESI" "Effective height" "Oblateness" "Horizon object" --------------------
This will help you to complete your translations and update them when new SE versions/patches are out. Simply copy strings from the log to the localization script and append them with translations. If you make completely new translation, copy and rename the file rus-gui.cfg - it have most complete list of text strings to the date (because Russian is my native language, and I always keep Russian localization updated).
Please check your translations in the SpaceEnigne. Make sure you don't made some strings too long, so they does not disturbs interface and does not overlap each other. If you don't know what some string or abbreviation means, ask it in this thread.
It is possible what in SE update some strings being deleted or changed. Your translation should be updated to remove or change them. You will see the following message in the log:
Code
WARNING: loc.SetLocalization(): Unknown translation strings found. Possible reasons: Obsolete translations (they should be removed from the localization file). Duplicated translations (search thought the localization file for duplicates). A lot of these strings may indicate a syntax error in the localization file. Swapped language may indicate an English string with missing translation for it. -------------------- "Video capture with GUI" "Video-Aufnahme mit GUI" "Video capture without GUI" "Video-Aufnahme ohne GUI" --------------------
The other possible reasons of this message is duplicated translations or syntax error (in most cases, missing quote "). Please check the log each time and make your localization free of error messages. Only in this case it could be considered as "complete".
The font texture with configuration script
WinXXXX-font.png WinXXXX.cfg
Default installation of SpaceEngine includes 4 font textures, which represents Windows-1250 (Central and Eastern Europe), Windows-1251 (Cyrillic), Windows-1252 (Western Europe), and Windows-1254 (Turkish) code pages.
Win1250-font.png - for Windows-1250 or CP-1250 code page. It represent texts in Central European and Eastern European languages that use Latin script, such as Polish, Czech, Slovak, Hungarian, Slovene, Bosnian, Croatian, Serbian (Latin script), Romanian and Albanian. It may also be used with the German language; German-language texts encoded with Windows-1250 and Windows-1252 are identical.
Win1251-font.png - for Windows-1251 or CP-1251 code page. It used for languages that use the Cyrillic script such as Russian, Ukrainian, Belorussian, Bulgarian, Serbian Cyrillic and other languages. It is the most widely used for encoding the Bulgarian, Serbian and Macedonian languages.
Win1252-font.png - for Windows-1252 or CP-1252 code page. It is the Latin alphabet, used by default in the legacy components of Microsoft Windows in English and some other Western languages.
You can open it in the Photoshop or GIMP and edit bottom half of the texture to add characters of your language. All characters made in a separate text layers, so you may just select the text edit tool and click on the character to edit it. Make sure you put the characters in the right places according to your national Windows code table. It is possible however to put characters anywhere in the texture and configure them in the font configuration script. But you should not change the digital, English, Greek and special characters sections of the texture, otherwise you will have incorrect characters for Greek letters and astronomical symbols in SpaceEngine. After editing, save the texture in the grayscale PNG format. You may use any format supported by SE though, but PNG is optimal for font textures.
The font configuration file is the text file with this structure (you may copy the win1251.cfg and rename it):
Code
// Table with chars parameters: offset from left side of cell and char width in pixels // for all 256 chars (texture resolution assumed to be 256*256 pixels)
// Register table to map a capital letters to small letters RegisterTable { 168 184 // 'Ё' - 'ё' 178 179 // 'І' - 'і' 170 186 // 'Є' - 'є' 175 191 // 'Ї' - 'ї' 165 180 // 'Ґ' - 'ґ' 189 189 // 'Ѕ' - 'ѕ'
....
}
It consists 3 digital tables - FontCharsParams, CodeTable and RegisterTable. The first table is used to describe horizontal offsets and widths of each character in the texture. So there two numbers for each character. You need change the bottom half of this table, which corresponds to bottom half of the font texture. To simplify it, enable the grid in the Photoshop or GIMP and set its cells to 16x16 pixels, so each cell will contain one character.
For example, lets look on the letter í in the win1252-font.png:
It is placed in the row №14 and in the column №13 (numbers are starting from zero). So find the two digits in the row №14 column №13 of the FontCharsParams table (the numbers are typed in the comments to facilitate):
0 4
The first number is the number of pixels from the left side of the cell to the character (enable the 16x16 grid in the Photoshop/GIMP). In this texture all characters are aligned to left, so this offset is 0. The next number is the width of the character in pixels. The letter í is a narrow, only 3 pixels wide. You should add one extra pixel to separate characters from each other in the text string, so width of this letter should be considered as 4. So its parameters are
0 4
Another example - letter Õ (row 13, col 5). It is wide, its parameters are:
0 10
The most wide character is the symbol of infinity, it takes two cells (this is possible), and its parameters are
0 18
The next table is the CodeTable - the table to map the keyboard (Unicode) codes into the font texture characters codes. If you use the code page 1252, no code table needed. Otherwise use the Unicode chart to find you character code (note that in this Wikipedia article the codes are in the hexadecimal format, you need to convert them to decimal - you can use Windows calculator for this). For example, lets look in the win1251-font.cfg:
Each row of the table corresponds to one character. The first is the Russian letter 'A', it have Unicode code 1040 and a number in the texture of 192. Number in the texture is the (number or row) * 16 + (number of column), numbers are started from 0, so 'A' have the number 12 * 16 + 0 = 192. Next letter have a number 193, next 194 etc.
The next table is the RegisterTable - the table to map a capital letters to small letters. You must fill this table for all characters expect default ones (digits, English letters, Greek letters and special SE symbols). If you did not fill this table, the search by name function in SE will not work correctly. For example, lets look in the win1251-font.cfg:
Code
// Register table to map a capital letters to small letters RegisterTable { 168 184 // 'Ё' - 'ё' 178 179 // 'І' - 'і' 170 186 // 'Є' - 'є' 175 191 // 'Ї' - 'ї' ...
Each row of the table corresponds to a Capital-Small character pair. The first number is a code (ie number in the texture, the same as in CodeTable table) of the Capital character, the second is a code of corresponding Small character.
The main menu texture
loc-menu.png
This is an optional texture, if it is not present, SE will use the default English texture eng-menu.png. However, if you want translate the main menu, here the link to the Photoshop PSD file:
Also, you should install the font ft40_Roman.ttf, if you haven't it (just double-click on the file and click "Install"). Open the Photoshop or GIMP after installing the font!
In Photoshop, click on the Slice tool - it helps to distinguish the cells of each GUI "button". Or create it manually by dividing the texture by 16 x 4 cells.
Each "button", except SpaceEngine logo and planet arc, is a text layer, that can be edited with text editor tool. Make sure text strings fits into their cells, except for 4 bottom cells "Export skybox", "Export system", "Export planet", and "Edit planet" - they are supposed to be 1,5 cells in width (look in the spoiler below).
After editing, save the texture in the color PNG format. Save the PSD file too, it can be useful in the future, for example if SpaceEngine logo gets changed or new menu entries added.
The in-game wiki database script
loc-db.cfg
This is a database file for the built-in Wiki system. If the file is not introduced, Wiki will be empty. The file can be created by SpaceEngine itself, when user adds a description for some planet or other object. The format of this script may be changed significantly in the future.
This database can be used to make a short descriptions in your language of some known objects like Solar System planets and moons, stars, galaxies etc. The script consists of several entries of this format:
Code
RObject { LocName "Chiron" Name "Chiron" Parent "Sol" Pioneer "Charles T. Kowal" Date "1977.10.18" Descr "[big]Chiron[/big]
Chiron was the first object to be identified as a centaur, a class of bodies that orbit the Sun between the orbits of Jupiter and Neptune. It has a very eccentric orbit that takes it from inside the orbit of Saturn to past the perihelion distance of Uranus. Its size is uncertain, but the most recent estimates yield a diameter of around 230 km. Its rotation period is 5[hour]55[min]04[sec]13. Chiron has been observed to have comet-like behavior, developing a coma and a tail as it nears perihelion. Like all centaurs, Chrion will eventually move into an orbit that will place it into a different category of objects, likely becoming a short period comet." }
PObject { LocName "Pelua" Name "RS 8403-240-5-18822-162 A4" Parent "RS 8403-240-5-18822-162 A" Pioneer "SpaceEngineer" Date "2012.09.03 08:02:17.26" Descr "Pelua - the fourth planet of the main component of a binary star RS 8403-240-5-18822-162, third the diameter and mass of Earth-like planets of this system. The planet has a relatively dense atmosphere and oceans of liquid water, but signs of life have not been found. It has five large moons, causing alternating strong tides in the oceans, as well as violent volcanic activity. Pelua is interesting place due to its size and mass, very close to the Earth's, so its surface gravity is only 2% higher than the Earth's. Thus it can be considered as a good candidate for colonization. However, the cool climate, the thin atmosphere (half of Earth's), tectonic activity, and oceans, saturated with salts of a phosphoric acid, is a serious obstacle to the mass colonization and full terraforming." }
RObject or PObject - an header of the database entry, for real (catalog) object and procedural object respectively. Different designations is used to distinguish objects in the Export / Import Wiki menus. LocName "Pelua" - a name of the object in your language, or name given to the object by its discoverer in the game. Name "RS 8403-240-5-18822-162 A4" - internal (or catalog) name of the object. Parent "RS 8403-240-5-18822-162 A" - internal (or catalog) name of the object's parent, if it exist. Pioneer "SpaceEngineer" - name of the player/discoverer. Date "2012.09.03 08:02:17.26" - date of discovery. Descr "Pelua - the fourth planet..." - description of the object. New lines and specital BB-like codes allowed.
Description is a not very long text shown in the Wiki window. It should be enclosed in the simple quotes " ", and allows a new lines inside them. To use quotes inside the description, use angular quotes: «Mariner-4». Description allows using of the BB codes, like on this forum (type them without spaces).
[ SUP ] text [ /SUP ] - upper index text
[ SUB ] text [ /SUB ] - lower index text
[ SMALL ] text [ /SMALL ] - samll font text
[ BIG ] text [ /BIG ] - big font text
[ HUGE ] text [ /HUGE ] - huge font text
[ COLOR=FA05C7 ] text [/COLOR] - change color (in Hex format, like in HTML) text
[ TAB ] - tabulation
Also SE supports abbreviations for Greek letters and some useful characters, that are represented in the font texture:
List of new strings introduced for the next version 0.9.7.1. I will update it during my work.
Changed old lines "Screenshot without HUD"--> changed to "Screenshot without GUI" "Screenshot with HUD"--> changed to "Screenshot with GUI"
New lines "Creating planetary system" "Video capture without GUI" "Video capture with GUI" "Recording frame" "auto" "Display" "Apply" "Window mode" "Fullscreen" "Windowed" "Custom display resolution" "Window size" "Vertical synchronization" "Anisotropy level" "Back" "Night side lights" "Astronaut" "Build menu" "Build" "Destroy" "App. mag"--- Translated string must be not longer than original English! "Abs. mag"--- Translated string must be not longer than original English! "Lumin."--- Translated string must be not longer than original English! "constructed" "destroyed" "Surf/sea altitude" --- Translated string must be not longer than original English!
"Unknown" "Discovery method" --- Translated string must be not longer than original English! "Radial velocity" "Transit" "Astrometry" "Microlensing" "Direct imaging" "Transit timing variations" "Transit duration variations" "Orbital light variations" "Eclipsing binary timing" "Variable star timing" "Pulsar timing" "Polarimetry" "Auroral radio emission" "Interferometry"
English is a default SE language that does not need a localization files (strings are embedded into SpaceEngine.exe). Russian is my native language, so this localization is always up to date.
Green localizations are up to date. Red localizations must be updated.
[eng] English [cro] Croatian [cze] Czech [esp] Spanish [fin] Finnish [fra] French [ger] German [ita] Italian [ned] Nederland [pol] Polish [ptbr] Brazilian Portuguese [ptpt] Portugal Portuguese [ro] Romanian [rus] Russian [sk] Slovak [swe] Swedish [tur] Turkish
Hm, I translated the gui into Swedish but when I tested it, most of the words I translated were still in English. Does anybody know what could have gone wrong?
I'll attach the file if someone wants to have a look at it.