We have a new system in EUIV. We are using the YAML ["http]
file format. It will look something like this:
MENU_MESSAGES_DISABLE_ALL: "Disable all"
TO_ME: "To me"
FROM_ME: "From me"
hre_province_restored: "Territory restored to the Empire"
Note the extra space at the beginning of each line except the first, which is needed since each row is a subnode to the node called “l_english”.
In order to localize a string with quotes within it, these must first be escaped, like so:
l_english:New Formatting Standard
STRING_WITH_QUOTES: "This string contains \"quotes\", therefore it's awesome!"
The localization system also has support for formatting text in the localization strings instead of the C++ code. In order to format a variable, type a '|' after the variable name in the localization text, followed by the wanted formatting rules and then end the expression with '$'.
The following formatting rules are implemented:
- % - conversion of value to percent
- * - conversion of value to SI units
- = - Prepend '+' if the value is positive and '-' for negative
- 0..9 - Number of decimals
- W,B,G,R,b,g,Y - colors the text
- + - Colors values green if positive, yellow if zero, red if negative
- - - Colors values red if positive, yellow if zero, green if negative
As an example, if we want to convert a fixed point value to percent with one decimal, color it green if it is positive, we can now write it as $VAL|%2+$.
If we want to color a value yellow with 3 decimals and and add a '+' sign if the value is positive, we could write it as $VAL|=Y3$ etc. Importing/exporting text to translate it
To export, create a shortcut of the game exe. Right click and choose properties, and enter
last in target. This will create a folder in your documents folder. For example: C:\Users\user_name\Documents\Paradox Interactive\Europa Universalis IV\localisation_untranslated and in that folder you'll find three files (subject to change) named l_german_out, l_french_out and l_spanish_out.
These files can now be opened and translated. Put your translation in the language column that applies. If yours are not there, you can rename one of the others.
To import, create a folder next to the recently created and name it localization_translated. Put your files there. They must be named l_language (name of the language) in the start of the file name and import with this line:
You will then get a bunch of files in your documents folder, in a new folder named
These files need to be copied and pasted into the localization folder in the game. When you have done both export and import, the structure will look something like this:
All in all, if you are translating for example our English text to another language, you won't need to care that much about the formatting, just mimic what we wrote. If you are adding text for your mod, you may want to give the first two headlines some extra attention.