Localization

本页面所适用的版本可能已经过时,最后更新于1.4

Localization translates the in code into names and descriptions into a more presentable in game format. It also allows the piece of code to be displayed differently in different languages in game.

Localization modding

Localization is handled by .yml files in the game/localization folder. An advanced text editor like Notepad++ and Visual Studio Code is recommended, however, if those aren't available, even standard Notepad will work. The naming convention for .yml files is <file>_l_<language>.yml where <file> is the name given for this group of localizations, and <language> is the language the localization is for. Supported languages currently include English (english), French (french), German (german), Russian (russian), Spanish (spanish), and simplified Chinese (simp_chinese).

Creating Localization Files

  • In the root mod folder (not in common), create a folder named "localization" (Note: Imperator uses localization with z, not an s).
  • Optionally, create language subfolders within the "localization" folder. This is organizationally helpful but not required.
  • Localization files are encoded as UTF-8-BOM. The easiest way to get the correct encoding is to copy an existing .yml file and modify it.
  • Alternatively, simply create a standard text file and save it as .yml with UTF-8 with BOM encoding. Various text editors, such as Notepad++ and Visual Studio Code, will allow you to manually save with encoding UTF-8 with BOM
  • The file name must end in "_l_<language>", with the language setting it will appear for
  • The first line of any localization file must also be l_<language>:.
  • Vanilla localization files do not need to be replaced, instead, simply add a new file with new entries
  • If you wish to change a vanilla localization, save your file within the "replace" folder. Any file in localization/replace will load after other localization files, and will overwrite any duplicate entries.
  • The number seen in vanilla files right after the colon can be omitted, as it is only useful for Paradox's internal translation tracking.[1]
  • Each string to be displayed in game is encased in quotation marks. To display quotation marks in game, input a backslash before each quotation mark (for example: text \"name\")
  • Note that the following unicode characters are invalid inside the localisation file and will generate a "?" instead: „ “ ‚ ‘ – ” ’ … —
l_english:
 wonder_lighthouse_of_pharos:0 "Lighthouse of Alexandria"
 wonder_giza:0 "Giza Pyramid Complex"
 wonder_halicarnassus:0 "Mausoleum at Halicarnassus"
 wonder_tomb_of_alexander:0 "Mausoleum of Alexander"
 wonder_tomb_of_alexander_entity:0 "Mausoleum of Alexander"
 wonder_colossus:0 "Colossus of Rhodes"
 wonder_dodona_oracle:0 "Oracle of Dodona"
 wonder_library_of_alexandria:0 "Library of Alexandria"


Color Codes

Inserting a hastag(#) followed by a letter and a space will change the text color in any localization string, #! will reset the color to the default. Definitions for # codes can be found in jomini/gui/jomini/basetextformatting.txt

Code Color
#Y Blue
#G Green
#R Red
#TF Light grey
#T Gold
#! Default

Text Icons

Inserting a @ followed by a text key and ! (@icon_name!) will place a text icon. Definitions for text icon codes can be found in gui/shared/font_icons.gui New icons can be added and defined in the gui/shared folder with

texticon = {
    icon = icon_name
    iconsize = {
        texture = "gfx/interface/icons/font_icons/icon_name.dds"
        size = { 16 16 }
        offset = { 0 4 }
        fontsize = 16
    }
}
Code Icon
@military_icon! Martial.png
@civic_icon! Civic faction
@oratory_icon! Charisma.png
@religious_icon! zeal修正