Getting Started with Game Modding Europa Universalis 4 - Part Three

Picture shows Jason A. Martin - Software Engineer, Indie Game Developer, Tech Evangelist, Entrepreneur.

We're almost home. In Getting Started with Game Modding Europa Universalis 4 - Part Two we created the bulk of an in-game event. In this part of the series, I'll show you how to get text into the event and onto the screen. It's localisation time.

Note: Because the formatting could be off on this page, I highly recommend you go to my EU4 Unicorn repo if you plan on doing any copy/paste actions.

Creating the Localisation File

Your localisation file will go in the /localisation folder (/mod/unicorn/localisation/) and needs to be a .yml file extension (YAML file).

Name this file unicorn_l_english.yml.

There are three important things you need to get right (explanations of each to follow below). If you fail here, your event will show up but in place of text you'll get a message about localisation not being found.

  1. You need to make sure the .yml file is formatted properly.

  2. You need to make sure the .yml file is UTF-8 with BOM filetype.

  3. You need to name it with the format: YOURMODNAMEHERE_l_english.yml. Example: unicorn_l_english.yml

Adding Localisation Text

For more information, here's the localisation wiki.

Here's our file:

 unicorn_1_title:0 "Holy Unicorn Spotted!"
 unicorn_1_desc:0 "Heretics be damned. We've spotted the holy unicorn that was prophesied in the Book of Tales. Oh holy one, what should we do?"
 unicorn_opt_1:0 "Fools! It is a false unicorn. Kill it!"
 unicorn_opt_2:0 "Alas, the day is here! Rub its belly!"

The file starts off by setting up a key of "l_english". The remaining lines are the values of this key (note the 1 space indentation of each line).

Each of the next lines has the format of KEY:0 "VALUE".

These keys are what we setup in our mod files previously.

For example:

 unicorn_opt_1:0 "Fools! It is a false unicorn. Kill it!"

This is the text for option 1 of 2 for our event. If you go back to unicorn.txt, you'll see this code that sets up the name for localisation:

option = {
		name = "unicorn_opt_1"
    add_treasury = 500
    add_mil_power = 200
    add_prestige = -30


As mentioned above, it's vital that your localisation files be in the format UTF-8 BOM. If you're not sure how to do this, check the documentation for the editor you're using.

For those using Visual Studio Code, the file format is on the bottom bar. You can just click it and select to convert it.

Once you have your file in the right format, you're ready to go.

Here's a screenshot of the file toolbar in Visual Studio Code. Notice the "UTF-8 with BOM" on it. Normally this might just say "UTF-8." Simply click it and follow the dialog to switch the the right format.

picture showing file toolbar in Visual Studio Code


The formatting and naming of the localisation file(s) matters. One wrong move and it's all broken. I've seen several threads around various sites where people couldn't get things working and the main reason why was because of formatting/naming.

If you get a localisation not found error, double and triple check your formatting. Another tip is to copy an existing localisation file into your mod, rename it and use it.

Keep in mind that spacing matters as well as quotes, colons, etc.

At this point we have all of the data required to get our mod into the game. In Getting Started with Game Modding Europa Universalis 4 - Part Four, we will wrap up with some last bits and game testing. Let's finish!