Localization

From Imperator Wiki
Jump to navigation Jump to search

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[edit]

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[edit]

  • 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[edit]

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


Documentation EffectsTriggersModifiersScopesVariablesData TypesLocalisationCustomizable localization
Scripting AIBuildingsCasus belliCharacterCharacter InteractionsCombat TacticsCountriesCultureDecisionsDefinesEconomic PoliciesEventsEthnicitiesGovernmentGovernor PoliciesIdeasModifiersMilitary TraditionsOfficesOn ActionsPartiesPricesPopsReligionScript ValuesScript ModifiersSetupSubject TypesTechnologyTrade goodsTraitsUnits
Map MapTerrain
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumMod structureTroubleshooting