Skip to content
lewri edited this page Jan 22, 2022 · 17 revisions

Description of how to implement and use different text for different languages

Localisation in CorsixTH

We have two types of languages in the game:

The first one is languages that are already in the original game. Most of the translation work has already been done, but over the course of development we have added new text or changed existing text (due to technical reasons or features). For example the French language is in the original game, but we have around 750 new lines on top of the original.

We also have languages that weren't in the original game - Russian and Dutch for example. These are 100% new to the game and at present stand at around 2,500 lines of text.

Configuration for larger character sets

To use the support for additional TrueType fonts through FreeType2 there are two steps to take:

  1. Download a suitable font file, such as uming.ttc bundled in the following package from freedesktop.org or choose a local font file.

  2. Specify the location of the desired font file in the configuration file in the variable unicode_font. This can also do this through the Font option in the game at the Options menu. For information how to find the configuration file check here.

List of languages

NB: This list is currently being reviewed and updated

Original languages (from original game)

English
French (Francais)
Spanish (Castellano)
German (Deutsch)
Swedish (Svenska)
Italian (Italiano)

New languages

Brazilian Portuguese (Português do Brasil)
Chinese (simplified)
Chinese (traditional)
Czech (Čeština)
Danish (Dansk)
Dutch (Nederlands)
Finnish (Suomi)
Greek (Ελληνικά)
Hungarian (Magyar)
Korean (한국어)
Norwegian (Norsk)
Polish (Polski)
Portuguese (Português)
Russian (Русский)

Works in progress

Romanian (Română) [Abandoned, help wanted]
Latin American Spanish (Español Latinoamericano) [Abandoned, help wanted]

Working on an existing language

Depending on how technical you are, there are then two ways to get started:

A The first way is to simply get stuck in, and start editing files. (More information can be found below or in our translation guide in the forum [Once you are comfortable, we can provide access to the google code site and let you submit your files/updates directly to the trunk.

B The second is where we provide you a little assistance. Providing the text in a generic format via e-mail, which you can easily work on. When you´re done, just send the edited file back to us and we will add it to the game ourselves.

Finding Translatable Strings

To see what strings can be translated, consult the existing language files here and/or do a string dump (Press Ctrl + Shift + D or turn on the debug option in config.txt (see Configuration File), then menu bar -> debug -> dump strings). This should create several text files in the directory your config file and your savegames are also located in.

  • debug-strings-orig.txt: Contains strings of the legacy system
  • debug-strings-new-lines.txt: Contains strings of the new string system line-by-line
  • debug-strings-new-grouped.txt: Contains strings of the new string system in a grouped manner (Can be used as a template for new languages)
  • debug-strings-diff.txt: Contains strings that are missing and strings that are superfluous in the currently selected language. (The strings we need translated)

Implementing a new language

If you'd like to see CorsixTH presented in a language not currently implemented, then you are able to implement a new language. The only restriction is that if you need to use characters / symbols / glyphs which are not present in the original Theme Hospital fonts, glyphs that are used in English, French, German, Italian, Spanish, and/or Swedish, you will also need a font file when playing the game.

Header

To start creating your language, you should create a file called language_name.lua in the CorsixTH\Lua\languages directory. Then open said file in a text editor, and add the following standard header:

--[[ Copyright (c) 2016 <your name>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. --]]

Font("unicode")
Language("ownname", "name", "code1", "code2")
Inherit("existing_language")
Encoding(utf8)

Where "ownname" is the name of your language in your language itself, "name" is the name of your language in English, and "code1" etc. are the ISO 639 codes for your language. Note that the "ownname" is used for display purposes, so make sure it is written in proper case. For the other entries, the case does not matter. The Font and Encoding directives are used to tell the game that this language needs additional glyphs. Make sure that the file itself is utf8 encoded. To make the process of adding a new language easier, you should include an Inherit line so that any strings which you haven't translated yet are still displayed (albeit in the inherited language). Note that until custom translatable sounds are implemented, the inherited language will also provide the receptionist announcements. For example, the last two lines of the header might look like:

Language("Deutsch", "German", "de", "ger", "deu")
Inherit("English")

Translations

The remainder of the file lists all of the translations for the language, in the format a.b.c.d = "translation";. To avoid repetition, translations can be grouped together inside curly braces, making the following two code blocks equivalent:

menu.file     = "Ye Olde File Menu";
menu.options  = "Ye Olde Configuration";
menu.display  = "Tweak ye olde eyes";
menu.charts   = "Avast - Charts!";
menu.debug    = "Arr! Debugging!";
menu = {
  file     = "Ye Olde File Menu";
  options  = "Ye Olde Configuration";
  display  = "Tweak ye olde eyes";
  charts   = "Avast - Charts!";
  debug    = "Arr! Debugging!";
}

Technical note: The normal rules of Lua assignment do not apply, so the above two blocks really are equivalent, and the second block does not erase any other keys present in menu.

Adding new strings

As features are added which were not in the original game, or things are implemented slightly differently, it can become necessary to display text to the player which was not present in the original game.

In this case, new translatable strings should be added. Rather than just writing "New text" in the Lua code, _S.section.whatever.new_text should be written, and then section.whatever.new_text = "New text" should be added to the English language file, along with any other language files which the author is familiar with. Note that new strings should always be provided in at least English, as all other languages (directly or indirectly) inherit from it for strings which are not yet translated into that other language.

Update other areas of the game

The files CorsixTH/Lua/config_finder.lua and WindowsInstaller/config_template.txt generate a config.txt file if it does not exist. New languages should be added to these files, ideally at the same time that the language is first complete.

FAQ

Q: Do I need any special tools to help translate? A: You can use any text editor that supports UTF-8. But we recommend Notepad++.

Q: I want to create a new language that you don’t already have A: Wonderful! Firstly it's a huge undertaking as we have thousands and thousands of lines of text, so ideally we would like a few people to work on a new language, but don’t let the amount of text worry you - contact us and let's talk!