Mods:AddingNewLanguage

From Civilization V Wiki

Jump to: navigation, search

The localization system in Civilization V was designed with flexibility and extensibility in mind. That said, adding a new translation to the game in a manor that will not prevent achievements from being unlocked or steam to have integrity issues is very simple.

Contents

Location

New translations should be added to <My Documents>/Sid Meier's Civilization 5/Text/ In this folder, database XML files are parsed and added immediately to the localization database. While you can spread your translation across multiple files, it's recommended to simply make it 1 large XML file. This is because it is faster to parse and less likely to run into situations where XML files were processed out of order.

For this guide, we'll create a file <My Documents>/Sid Meier's Civilization 5/Text/Language_Esperanto.xml


First Steps

The first steps to adding a new written language is to first create a new table that will be populated w/ our localized text. Next we will want to add a reference to that table in the "Languages" table. The "Languages" table contains entries for all written translations whereas the "SpokenLanguages" table contains entries for audio translations.

<?xml version="1.0" encoding="utf-8" ?>
<GameData>

    <!-- Create "Esperanto" translations table -->
    <Table name="Language_EO">
       <Column name="ID" type="integer" primarykey="true" autoincrement="true" />
       <Column name="Tag" type="text" notnull="true" />
       <Column name="Text" type="text" notnull="true" />
       <Column name="Gender" type="text" />
       <Column name="Plurality" type="text" />
    </Table>
    
    <!-- Add "Esperanto" language entry -->
    <Languages>
        <Row>
            <Type>eo</Type>
            <Name>Esperanto</Name>
            <TableName>Language_EO</TableName>

            <!-- Please see http://wiki.2kgames.com/civ5/index.php/Mods:LocalizationSyntax#List_of_Plural_Rules for more information on plurality rules -->
            <PluralRule>2</PluralRule>
        </Row>
    </Languages>

    <!-- Insert Translations Here -->

</GameData>

Extended Font Rendering

Civilization 5 by default uses a set of bitmap fonts to display text. This limits the character set to Latin characters only. In the case where additional characters or entirely new character sets are required, the extended font system can be toggled on. In order to use the extended font system, the example above must be modified as shown.

<?xml version="1.0" encoding="utf-8" ?>
<GameData>

    <!-- Create "Esperanto" translations table -->
    <Table name="Language_EO">
       <Column name="ID" type="integer" primarykey="true" autoincrement="true" />
       <Column name="Tag" type="text" notnull="true" />
       <Column name="Text" type="text" notnull="true" />
       <Column name="Gender" type="text" />
       <Column name="Plurality" type="text" />
    </Table>

    <!-- Add "Esperanto" language entry -->
    <Languages>
        <Row>
            <Type>eo</Type>
            <Name>Esperanto</Name>
            <TableName>Language_EO</TableName>
           
            <!-- Please see http://wiki.2kgames.com/civ5/index.php/Mods:LocalizationSyntax#List_of_Plural_Rules for more information on plurality rules -->
            <PluralRule>2</PluralRule>
            
            <!-- Include the following elements if you need to use extended fonts -->
            <UseExtendedFont>1</UseExtendedFont>
            
            <!-- Name of an installed font on the user's machine -->
            <FontName>Segoe UI</FontName>
         </Row>
    </Languages>

    <!-- Insert Translations Here -->

</GameData>

With the additional <UseExtendedFont> and <FontName> elements, the extended font rendering system will kick in and use the font specified.

Adding Translations

Because this is a new table, translations can be added with simple a <Row> element of the correct tag.

<Language_EO>
   <Row Tag="TXT_KEY_MAIN_MENU">
       <Text>INSERT TRANSLATION</Text>
   </Row>
</Language_EO>

Selecting your Translation

Now that the translation is finished and added to the text folder, it must be selected. Please read below for ways to select your new written translation.

NOTE: Changing the language from within the Steam client WILL override any language setting changes you make.

Config.ini

The game's config.ini can be located at <My Documents>/My Games/Sid Meier's Civilization 5/config.ini

Somewhere in the file, you will see the following snippet:

; The currently selected language.
Language = en_US

Replace it with the following:

; The currently selected language.
Language = eo

In-Game Options (May not be available depending on version)

Depending on the version of the game, this option may not be available at which point the only method will be modifying the config.ini file.

At the main menu, select "Options", then navigate to "Interface Options". A drop down called "Written Language" will be shown at which point you can select your new language.

TODO: Add Screenshot.

Personal tools