Translation File

From Exterminatus Manual

Jump to: navigation, search

++Mapping ++ Map Entities ++

Contents

Introduction

So that Source games can be translated into different languages all the text in the game is held in (relatively) simple text files outside of the code. Extemiinatus makes use of this technique and extends it to the text used in it's custom map entities (Objectives, Missions and Timers).

The Valve Way

Each steam account has a configured language setting. When a Source game loads it looks for files called <filename>_<language>.txt , where <filename> cames from the game code and <langauge> is the user's language setting. If it does not find one it will try and load <filename>_english.txt . So if you specify say French as your preferred language, but the game has not been translated into French, it will instead load the English translations.

These text files contains "token" and "value" pairs in Valve Text File Format. The "token" parts reside in the game code and get swapped out for the "value" parts when the game is played. This is used wherever you see text in a source game, in the menus, on the HUD, the scoreboard, death messages, everywhere.

The Exterminatus Extension

EX makes use of this technique and also extends it to it's maps. In order to relay rich mission details and keep players informed requires mappers to produce quite a lot of text.

When an EX loads a map it checks for an ex_gameplay entity in the map, if it has one and it specifies a Translation File EX will add on the player's perfected language and the .txt extension and try to load that file from the maps folder. If their is no ex_gameplay or it does not specify a translation file EX tries to load a translation file with the same name as the map (plus the players language and .txt). In either case if their is no translation available for the preferred language EX will try and load and English language version. This allows you mappers to include your own translated text with your maps and for yourself or others to translate it into other languages.

Usage

Objective names as displayed on the HUD and the tactical overview use the translation whose token comes from the ex_objective's "Name Token" property.

Mission text comes from the translations whose tokens come from the ex_mission's "Imperial Token" and "Tyranid Token" properties.

If you use a token that does not appear in the translation file the token itself will appear in-game.

Sample Translation File

Here is a sample of what your translation files should contain:

"lang" 
{ 
	"Language" "English" 
	"Tokens" 
	{
		"neutral_tyranid" "USE the button on the skull console to capture the neutral objective"
		"neutral_human" "USE the button on the skull console to capture the neutral objective" 
		"tyranid_tyranid" "Defend your console and capture the neutral objective"
		"tyranid_human" "USE the button on the tyranids console to stop them spawning" 
		"human_tyranid" "USE the button on the humans console to stop them spawning"
		"human_human" "Defend your console and capture the neutral objective" 
	} 
}

In this example "neutral_tyranid" is a token and "USE the button on the skull console to capture the neutral objective" is the text it translates into.

Navigation