|
Localization
Description of how to implement and use different text for different languages
Languages in the gameIf you wish to find out when a language was last updated, go to the Source tab and find the languages folder. Original LanguagesThese languages were in the original game and therefore have a lot of translated strings "for free". Legend:D = The language is as complete as it can be. New strings are translated within a week. N = A few strings are missing. Mostly those that have been added recently, but possibly also some from the original game. P = Translations are being written at the moment. Check out the associated issue in the bug tracker for progress reports.
New Languages
Adding new stringsAs 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. Legacy System and New SystemPrior to r373, the original Theme Hospital string tables are used to provide text in different languages. In this system, each string was identified by two numbers (for example, (44, 107) identified the string describing the cause of broken wind), and Lua code referenced strings using the global _S function (for example, _S(44, 107) returned the string describing the cause of broken wind in the current language). There were several issues with this system:
Hence, starting from r373 (having been discussed in issue 139), a new system is in place for translatable text. In this system, each string is identified by one or more name parts (for example, diseases.broken_wind.cause identifies the string describing the cause of broken wind, and menu_options_volume[60] identifies the string for 60% volume in the options menu). Lua code references strings under the global _S table (for example, _S.diseases.broken_wind.cause gives the string describing the cause of broken wind in the current language). Strings can still originate from the original game string tables, but they can be changed, be given names, or be augmented by text (rather than binary) files. Strings from the original game are given names by the CorsixTH\Lua\languages\original_strings.lua file. At the current time, not all strings have been given names, so a temporary mechanism is in place to allow existing Lua code to still use the deprecated _S(x, y) method for accessing strings. Technical note: The values returned by indexing or calling _S are not actually strings, but infact clever userdata which look a lot like strings. Most of the time this shouldn't be an issue, but there are a few gotchas: string methods should be called using the method syntax (s:gsub(...) rather than string.gsub(s, ...)), equality testing between two strings cannot be done in the normal manner (for technical reasons), and the byte,find,gmatch,match, and sub methods are unavailable. Implementing a new languageIf 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. HeaderTo 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) 2011 <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")TranslationsThe 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. Finding Translatable StringsTo see what strings can be translated, consult the existing language files (Norwegian is a good example) and/or do a string dump (turn on the debug option in config.txt, 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 (see ConfigurationFile).
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
Thank you for this!
I will start with the norwegian bokmål right away! I just need to find out how to checkout files/upload new language files:) (new to this svn thing)
eeerlend
One question...
If many people contribute to translate the game, how do we handle disagreements? Should we have a part on the forum for discuss each language? I just can imagine this problem when it comes to translation of longer strings as deseases (causes, symptoms and treatment) and the announcements...
Some language-modification is needed to keep the original sense of humour. Like the string "Patients are asked to be patient", which is a sort of "word-play" (dont know the english word for this:). Maybe this problem is best handeled with an own forum-section/wiki-page for each translations?
I think translation problems like correct medicine translations vs. modificated humourized translations are best handled in the community...
Im glad to help with this section (in norwegian), and can be a forum-moderator if you like...
But I'm new to svn and programming, so maybe there is a better way deal with this problem?
eeerlend
Once there are multiple contributors for one language, I think a forum thread "Norwegian Translation: Discussion" or something of the likes will be enough, not an entire section.
Hmm, does this mean a translation into Danish is impossible, since we have Æ/æ and Ø/ø in addition to Å/å?
æ is actually available, but not Æ and Ø/ø, so as long as no sentence starts with Æ and if you can use Ö/ö instead it's possible. In the distant future we probably want to find other fonts/make our own though and then it should be no problem.
Special Characters
Do we mean back-slash?
@themidnightoker: thanks, fixed.
Is there a full list of strings including what was in the game like the Norwegian translation? There weren't any .dat files I could open, did you use a particular program to open them or the real lang files.
no worries -sadly thats about my level for the time being ;)
@SyntheticDolphin?: When you start the game in debug mode (set the corresponding entry in config.txt to true), you have the option Debug->Dump Strings in the menu bar. If you do this, a couple of .txt files will be created in your CorsixTH folder. The file with "orig" in its filename contains all the original strings, in a numbered scheme adopted from TH. The files with new-grouped and new-lines each contain (in a different presentation style) ALL the strings that have been made ready for the translation system - including new strings we added for some stuff like e.g. the main menu. The latter two are also already in a format that you can use in your language?.lua. You only have to copy&paste and then translate from english.
Let's say I install the itlaian version of the game, then CorsixTH, then I dump the strings form debug mode. The .txts that are created contain the italian strings or the english?
I have translated the english .lua, and I'd like to check if there are errors in the "old" italian strings that I can correct.
The created files contain the italian strings, yes.
It depends on which language you set CorsixTH to run in (you can specify that in config.txt). Whichever language you enter there, will be the language used ingame and for the string dump. Strings not yet translated will fall back to english (if you specified that correctly at the start of the italian.lua).
Ok, thanks for the replies. I'm going to search for my old Theme Hospital cd and control everything.
Let's just hope I haven't lost it in the middle of the black hole that is my game cabinet.
Translation into Chinese: Simplified Chinese --- 简体中文 Traditional Chinese --- 繁體中文
Chinese divided into Simplified Chinese and Traditional Chinese, then how to fill in the "header" part?
Hello, I would like to assist the Spanish translation for CorsixTH. I've got the Beta2 file translated. How can I send it?
Make an issue and submit it as a patch.
lwglwss: Good question. ISO639 seems to be lacking in this area. Actually this was just a guideline, it's not imperative that these names are the iso codes. We just specified that because it's one thing someone might try to enter into the config file and that should be recognized. However, they must be unique, so if you're planning to do one simplified chinese and one traditional chinese translation file, their names must indeed differ. I would suggest: Language("简体中文", "Chinese (simplified)", "zh(s)", "chi(s)", "zho(s)") and Language("繁體中文", "Chinese (traditional)", "zh(t)", "chi(t)", "zho(t)")
but if you have better suggestions, please do so. For now (in r768), I didn't include the own name of your translation, because 1) I wasn't sure if it's simplified or traditional and 2) we can't display it correctly at the moment anyway.
--- mccunyao: Great! The best way would be to open a new issue at our issue tracker for your language (name it "spanish translation" or something) and attach your file there. If you want to help some more, we have quite a few new strings introduced since beta2, so if you can grab a newer version, you have some more strings to translate :) If you don't want to bother with svn, try a precompiled build in the forums.
I wrote that "chinese.lua" is the Simplified Chinese. Should "chinese.lua" renamed into "simplified chinese.lua"? Later on I would like to make a "traditional chinese.lua".
Sure, that would work well. I'll change the name of the current file to simplified_chinese when I get home from work unless someone else have already done it.
The "chinese.lua" has entered into SVN, and then I want to modify this file, how to do that? For example, add or modify the inside of the translation, and change name into "simplified chinese.lua".
You make the changes you want and make an issue about it in the track log, when Corsix thinks it is time (probably soon...) you will get direct access to the repository.
i see size of finnish.lua more than english.lua it will make some trouble for translate. i know english match better than finnish but in english.lua not all strings from the game.
and i want to know how to made another font for this game? i have russian version with russian font, but he didnt work properly with CorsixTH. so i need to manual create my own fonts. it is must be modify some file in originaly game?
english.lua is smaller because english is one of the original languages from Theme Hospital. That means that a big part of strings come from the original TH data, only the ones that we changed or added are in english.lua. To get a complete list of strings in english, start the game in debug mode and use the string dump option, as described above in the section http://code.google.com/p/corsix-th/wiki/Localization#Finding_Translatable_Strings .
About fonts, corsix only recently implemented support for freetype2, which will be used to support languages that need other letters than what the original fonts supply. You have to checkout from SVN or get a development snapshot ( http://th.corsix.org/corsix-th-latest.html ) for that, if you haven't already, as it's not in beta5. Then, see the header of traditional_chinese.lua to see how to set up your lang file to use freetype font. Here's a screenshot of a small test I did, it seems to work :)
Google is eating my link. Let's try again:
How to use the latest version? I can't see the chinese language option?
Oh, it seems that the development snapshot is not compiled with FreeType? support. Makes sense actually, since that just got into trunk. That means for now you'll have to compile yourself (activate WITH_FREETYPE in cmake), or wait until corsix has set up the automatic builds to include freetype support.
where i can download youre version with this fonts? i am not have idea how to compile this... not enough education.
and i think anyway client it self need inside game font. i think this method for CorsixTH as another programm.
Thank you very much corsix, the latest version has support for Chinese characters, but I have a small suggestion, Chinese characters are slightly a bit ugly, right? Could change a kind of unicode fonts, or use a special chinese font to display chinese.
seregaz2004: As of r1154, the pre-built binaries at http://th.corsix.org/corsix-th-latest.html include FreeType?.
lwglwss: If you're using SDL, then fonts are rendered without alpha blending, which looks a bit ugly for fonts without bitmap strikes, so I'd recommend trying DirectX / OpenGL (which have alpha blending), or a font like Arphic UMing (which has bitmap strikes). That said, the choice of font / method for choosing font is not yet set in stone.
so? what i must to download from this url? so manu folders and files... i am not understand... i am talking about where i can download youre exe file from screenshot with russian font.
seregaz2004: download this http://th.corsix.org/corsix-th-r1154-win32-ogl.zip then create Russian.lua in \Lua\languages folder,look at chinese.lua.
corsix: The Arphic UMing font is acceptable, but it can not be used for windows, to how to do it?
how to know name of originaly font? as you can see on screenshot originaly is nice and with "shadows", but unicode is terrible. and in menu when mose move some bugs.
The original font cannot be used as it does not contain the characters required for russian or chinese. That's the whole point of adding freetype support.
Please be a bit patient with the looks, remember this feature just got implemented. We'll see if they can be improved somehow.
The strange artifacts in the menu are indeed a bug, it would be good if you could report it as an issue in our issue tracker.
i mean corsix it self font, that used as external font for game. i want to litle edit this font, for more like original with hadows :) and one more for bugs - when patient go to farmacy and drink some - his animation half dissappear, and i can see wall behind this patient.
seregaz, я хотел бы поучаствовать в переводе. Напиши, пожалуйста, как у тебя успехи (в том числе со шрифтами) и загрузи свой патч сюда.
да как бы никаких успехов :) вот мучаю этих товарищей по поводу шрифта. сам корсикс использует какой-то свой шрифт. вот я хочу его взять и немного переделать, чтобы внешне стал походить на тот, что оригинальный симпатичный английский с тенями. перевод в большей части старый - я его "выгрузил" из досовский, русифицированной версии. некоторые буквы правда кодировка досовская съела, но я восстановил. ну и местами корявый перевод нужно чуть чуть препарировать. ну и некоторые названия надо переделать типа вместо ресепшена - регистратура, вместо GP офиса - участковый врач :) ну и при русификации само меню начинает глючить вон на скриншоте выше. roujin.mw пишет, что надо подождать, пока выйдет обновление. вот жду... жду название шрифта и обновления :)
Насчет шрифта согласен с тобой. Глюков как на скриншоте я в не встретил в r1184, может уже пофиксили?) Можешь выслать то что ты "выгрузил" на мыло? Я там свой перевод менюшек добавил http://code.google.com/p/corsix-th/issues/detail?id=650&start=100 предлагаю объединить правки и перенести обсуждение туда.
how to unpack original FONT01V.TAB & FONT01V.DAT files? external corsix-th font is white - so if i use utf - on fax screen i cant see any message. and whole text in the game one type of font. i am still want to edit original TH files, but i dont know how... i can made some smart installer, with backup original files - so user can make choice. corsix-th + originaly modifed files (few font) will looks match better, than only corsix-th (one font).
Seregaz2 I believe this is the unpacker used http://sourceforge.net/projects/dragonunpacker/
not helped
Hi, I'm having trouble using the string dump. I've turned on debug mode and tried creating the dump files from both the shortcut and the debug menu but the only file that is created is the gamelog.txt file with the following content: Created game with savegame version 37.
I'm currently running Beta 6 (update 2).
Best regards,
@sr.: the string dump files are currently created at the location of the binary, rather than appdata where the config, gamelog and saves are found.
Hi, I have strange problem: setting
Font("unicode")
in language file couse an error while running game ("Bad argument #1 to setFace"). How to correct that? (I'm using Beta7 on Windows).