Localisation
HOI4 uses the modified YAML localization system used by modern Paradox games.
Contents
[hide]Basics[edit]
The basic format is as follows:
l_<language>: <key>: "Text here"
Typically you will want to use l_english. The key refers to the script name of the object you are localizing.
Here is an example of a localized equipment:
l_english: infantry_equipment: "Infantry Equipment" infantry_equipment_short: "Inf. Eq." infantry_equipment_desc: "This is infantry equipment"
You must follow the syntax exact when adding localization, otherwise the parser will break and you will have broken localization.
The .yml format is a simple text file, to save as it simply save as All types and type in the .yml suffix.
Make sure the .yml file is encoded as UTF-8-BOM. This is easy to check and to change in Notepad++ or other similar programs.
Special Characters[edit]
Quote[edit]
Quote characters in text will be interpreted as part of the file if they are not escaped properly.
l_english: example_key: "This is "my quote" within a string."
This example would not be read correctly, as the parser would treat the second quote mark as the end of the string.
To avoid this, escape the quote mark with the \ character.
l_english: example_key: "This is \"my quote\" within a string."
In-game, the \ character will not be visible.
New Line[edit]
You may want to force a string to display with a line break. To do this, include the \n character where you want the line break.
l_english: example_key: "This is line 1\nThis is line 2\nThis line 3."
Formatting Characters[edit]
Various characters can be added to a string to alter it's presentation ingame.
The following formatting characters are implemented:
Code | Effect |
---|---|
§% | Converts following value to percent. |
§* | Converts following value to SI units. |
§= | Prefixes following value with + if the value is positive or - if it is negative. |
§0..9 | Controls the number of decimals to display. |
§W | Colors the text white. |
§G | Colors the text green. |
§R | Colors the text red. |
§B | Colors the text blue. |
§Y | Colors the text yellow. |
§b | Colors the text black. |
§M | Colors the text light blue. |
§g | Colors the text gray. |
§T | Colors the text turquoise. |
§l | Colors the text lime green. |
§O | Colors the text orange. |
§+ | Colors the following value green if positive, yellow if zero, red if negative. |
§- | Colors the following value red if positive, yellow if zero, green if negative. |
§! | Ends the current formatting rule. |
Here is an example of the color formatting:
l_english: example_key: "This is my text, §Bthis text is blue§!, and §Rthis text is red§!"
Text icons[edit]
Icons can be displayed within strings using the £ notation.
l_english: example_key: "£army_experience"
Text icons are defined in the texticons.gfx file by default, although new ones can be added in any .gfx file.
Namespaces[edit]
In specific contexts, such as events, it is possible to use namespace localization. This operates using the scopes with special functions in an object-oriented manner.
l_english: example_key: "[Root.GetName]"
This would grab the name of the ROOT scope and display it as the string.
It is possible to string scopes together:
l_english: example_key: "[From.Owner.GetName]"
This would grab the name of the OWNER (country) scope of the FROM (province) scope for the current ROOT (country) scope, and display it as the string.
You can use country tags:
l_english: example_key: "[HUN.GetRulingParty]"
You can use event targets:
l_english: example_key: "[was_attacked.GetName]"
Functions[edit]
- GetName
- GetNameDef
- GetAdjective
- GetAdjectiveCap
- GetLeader
- GetRulingParty
- GetRulingIdeology
- GetRulingIdeologyNoun
- GetPartySupport
- GetLastElection
- GetManpower
- GetFactionName
- GetFlag
- GetNameWithFlag
- GetCommunistParty
- GetDemocraticParty
- GetFascistParty
- GetNeutralParty
Documentation | Effects • Triggers • Modifiers • Scopes • Localisation |
Scripting | AI • Bookmarks • Buildings • Cosmetic tags • Countries • Divisions • Decisions • Equipment • Events • Ideas • Ideologies • National Focuses • Resources • Technology • Units |
Map | Map • Terrain • States • Supply areas • Strategic regions |
Graphical | Interface • Graphical Assets |
Cosmetic | Portraits • Namelists • Music • Sound |
Other | Console commands • Troubleshooting • Mod structure |