November 18, 2019, 12:38:17 AMLatest Member: TBCKaspersky

Author Topic: CorsixTH Translation Guide  (Read 5158 times)

0 Members and 1 Guest are viewing this topic.


  • Community Manager
  • ****
  • Posts: 268
  • Translator & Superman
    • View Profile
CorsixTH Translation Guide
« on: September 05, 2011, 08:06:23 PM »
CorsixTH translation guide

If you want to contribute to this project by making a new (or improve a) translation, this guide could be of good use.

First of all
Before starting on a new translation you should be sure that it hasn’t been made already (or that someone else has started on it). You can check this by looking for a thread including your language name in the sub-forum called Translations.
You should also check the project’s Google Issue list first. Just go there and search for the name of your language.
If you don’t find your language in any of these two places, then you should be ready to start on your translation.

When you feel like you have a reasonable first draft or edition of your translation, then it’s time to let others know what you have made. This can be done either by posting in the forum or on the issue list.

It is recommended that you make a post in both places.
Take a look at "How to get your translation into the game (sharing it with others)" further down in this guide.

If you later on realize that someone else already have started a similar translation, then try to contact the other translator and find out how to help on his/hers translation, or maybe even merge these two translations.

Starting on a completely new translation
There are two ways to make a translation for a new language.
The easiest way is to simply copy an existing translation file and translate that one into your own language (assuming you know the language you are translating from).
You should (if possible) pick a translation that is built up logically (and not totally random), since this is much easier to work with. Both for you and those who might improve/continue your work in the future.

PS: One can not translate directly from the english.lua! How to translate from English is mentioned in “The hard way (translating directly from English)”.
The reason for this is that the english.lua doesn’t contain all of the text strings that needs to be translate. The english.lua contains about 400 lines, while a “full translation” can contain over 3000 lines.
The other English lines are taken from the original game’s data files.

PPS: A “fix” for this could easily be made if someone took the time to make a “dummy” language file for the English strings, so that translators could copy and translate from that one. But if someone takes this task, one should be extra careful to get a logical build of the file, so it’s easy for translators to work with afterwards.

The easy way (copying a finished translation)
Lets take the Norwegian translation as an example, since this is pretty logically built, and use this as an basis for how to build up the new language.
First get through these folders: main game folder, LUA, languages (e.g. on MS Windows: \Program files\CorsixTH\LUA\languages\).
Here you see all the languages for the game so far.

Now open norwegian.lua with your favorite text editor (I prefer Notepad++ on MS Windows).
First you will see about 60 lines on copyrights and how the text string categories are arranged, then you will see some global settings.
You should change the name/names in the top to your own name and/or nick name when you have copied the content from the language you prefer to translate from.

Now for the global settings. These should be changed to fit your language.
The best way to learn how to do this is to read “Implementing a new language” in the wiki.
PS: The copyrights and font settings can also be copied from there.

The hard way (translating directly from English)
A harder way to create a translation is to go through the english text.
The reason this is harder is because there is no "clean" language file with english strings like all the translations.

The way to do it this way is to first make a new file with the *.lua ending. If you don’t get it right, just copy another language file, change the name and delete it’s contents to start from scratch.
Then you should copy the copyrights from “Implementing a new language” in the wiki (or an existing translation).
You should also copy the global settings (language settings), and edit this to the name/names of your own language (explained in the link above).

Now you should make sure that the debug menu is turned on in the game.
This can be done by finding your config.txt and change the debug setting to true, like this: debug = true
(read this to locate the config file)

When that is done, you should start up your game, go to options and change into your own language (the one you are translating to).
Now start up any level (example level is fine), move your mouse to the top of the screen to see the menu, go to the debug menu and choose "dump strings". Exit the game.

Go to your main game folder, and open the file debug-strings-diff.txt
Here you will see all the strings from the English language that isn't translated to your language (and at this time that is all of the strings).

You will have to categorize and copy these strings into your own language file, and then translate them.
It is smart to add these strings as you translate (and not just add them all at once), since you then can see what you have to add next (just update this list by going into the game and dump the strings again).

Some technical tips
You should only translate what is inside the quotation marks (" ").

A text string should always end with a comma after the last quotation mark.

If you want to add explaining messages for yourself or others, you can add a space after the text string, and then two minuses (like this: random = "random text string", --message or explanation).
The text after (and including) these minuses will not be shown in the game. This can only be seen from the text editor ( if you are using Notepad++, it will appear in green color when written correctly).
This is nice for strings that needs further work. Just mark them with this for example: --todo
And when you or someone else want to improve whatever string you have marked, they could just search for the text "todo", and find what needs to be done.

For convenience, another tip is to never use TAB as a space function (unless you reassign it to use separate spaces in your text editor).
Because different programs use different lengths for the TAB character your nice formatting will then be spoiled for others viewing your file.

Just have a look at some of the code used in the existing files, and you will soon see what you can and cannot do.

What is a .lua file?
A *.lua file is a file containing code for the game. In our case it contains the strings that are (or needs to be) translated.
It can be opened, read and edited by any standard text editor.

How to get your translation into the game (sharing it with others)
After you have translated some or all of the text, you should go to the project’s “issue list” (found here:
1) Click the button “New Issue”.

a) change the template to “Patch from user”.
2) In the summary you should write “Language: <yourlanguage>” to make it easy to find (e.g. Language: Norwegian).
3) Remember to attach you language .lua file with the button “Attach a file”.

After you have made some submits through the Google Issue list, you might get privileges to add your translations directly to the subversion (SVN) file repository (without having to post it in the Issue list for others to add it).
If you get this permission, then you will need a SVN program (e.g. TortoiseSVN for MS Windows), but a more complete list can be found on Wikipedia.

Thanks to Lego3 and Froksen for contributing!
« Last Edit: October 30, 2012, 05:24:02 PM by Grimdoc »
Do you have a question or want to report a bug? CorsixTH newbie guide

Do you want to make (or improve) a translation? CorsixTH translation guide