Guides‎ > ‎


Since TTT version 22 it is possible to translate all the text in the game to a different language. When such a translation is installed on the server, all players can then select the language of their preference in-game without a need to reconnect or restart.

This page explains some things about language files, and the practical side of translating.

I'm writing this under the assumption that you don't have Lua or programming experience. If you do, you probably don't need this guide.

You can find some existing translations in this forum thread.

Getting started

I'll be calling a translation of TTT a language in this guide, for convenience. A TTT language is a Lua file containing all the text in the game.


Translating involves changing a lot of text between quotes, so it can be easy to accidentally delete a quote, which will cause errors in-game. An editor that knows about Lua can help you keep track of the quotes, for example Notepad++. It will color the text so you can easily see it when something is wrong.

It's free and easy to install and use, so from here on I will assume you are either using Notepad++, or you really know what you're doing (ie. you are already familiar with Lua etc).

Language file

It's convenient to start from the English language file, and just replace all the English text with translations. If you have a server or know someone who does, you can get the English language file from: \garrysmod\gamemodes\terrortown\gamemode\lang\english.lua

You can also find it in your GMod GCF, or download it from the GMod SVN.

So to start your translation, copy and rename that file. Open it in Notepad++ and read on.

Language basics

Defining a language

You will notice this line at the beginning:

local L = LANG.CreateLanguage("English")
It essentially tells TTT that there is a language in this file, namely English. Change the "English" to the name of your language. This is also the language name that players will see in the settings menu. I'll use "Dutch" here for the example:
local L = LANG.CreateLanguage("Dutch")

You could now skip to the "Installation" section and select your language in-game. The above is all you need for the language to exist. Of course, all the text will still be English.

One last thing of note before we start translating: certain lines start with a bunch of dashes. Notepad++ will color them green. For example:
--- General text used in various places
These are comments that are ignored by the game, they're only there as information for you. You can modify them, delete them, whatever you want.

Translating, basic text

All the lines with pieces of text that make up the language start with something like:
L.traitor = ...

That part you should not touch. The text you should translate is between quotes. I've underlined it here:
L.traitor    = "Traitor"

This is probably obvious. I'm just making sure. Here I've translated it to Dutch:
L.traitor    = "Verrader"

That's all there is to it.

Translating with parameters

Certain pieces of text have a bit more to them, however. Like the ones with parameters in curly brackets, such as {amount}. TTT will search for those and replace them with a piece of dynamic information when it shows the text in-game, like the name of a player, or a time, or the number of credits involved. You can move them around, change their order, and even delete them (not sure why you'd do that). However: don't translate them. TTT won't be able to find and use them if you do.

Let's have an example:
L.credit_kill      = "You have received {num} credit(s) for killing a {role}."

Two parameters: {num} and {role}. The first is the number of credits the player received, and the second is the role of the player he killed (like "Traitor"). Both Detectives and Traitors can get credits for killing one of the other side. If a Detective kills a Traitor, and the server has configured that he'll get 2 credits, then {num} becomes 2, and {role} becomes Traitor.

Translating to Dutch:
L.credit_kill      = "Je hebt een {role} gedood, daar krijg je {num} credit(s) voor!"

Note how I changed the order of the parameters. That's just because I felt like it, but some languages are very specific about word order, so it may come in useful there. Of course, the parameters are still in curly brackets and not translated.

Just to see parameters at work, this is how it would appear in-game with that Detective-killing-Traitor scenario I described above:
Je hebt een Verrader gedood, daar krijg je 2 credit(s) voor!

Notice how for the {role} parameter it automatically used the translation of Traitor that I made earlier in the guide ("Verrader"). Sweet! Anyway.

Translating longer text

Some text in TTT spans a few lines and has to fit in a menu properly. We want to be able to specify where it should start a new line, so we can have two blank lines and such. We can't do that nicely with plain quotes, because Lua will have a heart attack. Instead, we have to use square brackets like so:

L.item_armor_desc = [[
Reduces bullet damage by 30% when
you get hit.

Default equipment for Detectives.]]

Instead of "some text" it is now [[some text]]. Additionally, you may recognize how it looks similar to the way the Body Armor item description looks in the equipment menu in the game. The area for the description in that menu is a bit thin, so a new line starts after 'when'. Then below that there's a blank line, which will also be there in-game. What you see is what you get.

Perceptive readers may notice that the first line break, right after [[, is not shown in-game. That's a handy Lua feature, it ignores the line break if it comes right after opening brackets.

If you translate text in square brackets, you can experiment a bit with how long a line of text can be before it gets cut off. Or you can try and keep the lines the same length as the English text.

There are only a few places where you need to bother with manual line breaks, mainly the equipment menu descriptions. It's kind of a hassle but you have full control on how it will look in-game.

Special characters (accents, umlauts, etc)

If you use special characters like "äéöü" and such in your language, then you need to make sure the file has the correct encoding for Source to be able to display them. If you don't already know what encodings and unicode and such is, then believe me: you don't want to know. Let's just look at the setting you need to change.

In Notepad++, if you open the "Encoding" menu at the top, you should see something like this:
That means the file is encoded in "ANSI" right now. Not important.

Click "Convert to UTF-8 without BOM". That's the format that makes it work in the Source engine. You might be thinking right now, "But dear maker of guides, what in heaven's name is a BOM?", to which I say, "Shush, you do not want to know, remember?"

After you click it, save the file and close it. Now open it again in Notepad++, and open the Encoding menu again. It should now look like this:
If it says "Encode in ANSI" again, then your language probably did not have special characters in it after all. In all other cases, it should look like the above. All your special characters should now work in-game.

You cannot save in the correct encoding in standard notepad, which is why you should be using Notepad++ like I told you, dammit!


You should now have a file called something like "dutch.lua", but with a different language name. The filename doesn't really matter, but it's convenient. You can make it "dutch_by_xOxrobbie1991xOx.lua" as well, the game won't care.

That file needs to be on the server, in this directory:

The server's Lua cache will be re-generated when you start the server, so if you use FastDL/sv_downloadurl, then you should upload the new cache there.

Now, if you join the server, you can press F1 and switch to the settings tab, where the dropdown box will have your language in it. Select it and close the menu, and your language is now active. HUD text, like the "traitor/innocent/detective" text in the bottom left, should change immediately.

Server configuration

Servers can specify a default language. All players that have their language setting set to "Server default" (which is in fact TTT's default setting) will automatically use the language you specify. This allows you to run, for example, a French server where all newbies that join automatically see everything in French.

Use this convar in your server.cfg:
ttt_lang_serverdefault "english"

Okay, that covers everything I can think of right now. If you run into problems feel free to post on the TTT forums so I or others can help you.