Jump to content
mr.devolver

[HOW TO] Write a basic Localization.txt for your mod

Recommended Posts

 Hello everyone,

 

recently I was trying to help another modder who wanted to learn how to write his custom Localization.txt file for his mods. Although the original idea was to give him a quick answer, it turned out to be a little tutorial I thought someone else may find useful, so here it is for everyone:

 

Think of the content of Localization.txt as if it was the content of a table. As long as you stick to the vanilla format and follow its rules, you should be fine. Always try to match the vanilla format whenever possible.

 

Following these three simple rules will help you to write your own basic localizations from scratch:

 

1. First line of Localization.txt is always the table header with all kinds of labels or descriptions for entries below it. In other words, they should give you a hint as to which entry is expected where. This is the first line in vanilla:

Key,File,Type,UsedInMainMenu,NoTranslate,english,Context / Alternate Text,german,latam,french,italian,japanese,koreana,polish,brazilian,russian,turkish,schinese,tchinese,spanish

 

2. As you can see in this first line, all the entries must be separated by commas thanks to which the game knows where the new entry is and everything after a comma is treated as a new entry. However, what if we needed to write a long text such as item description that may contain several commas that we actually want to show in game? That's what the rule number 2 is all about:

 

Writing long texts that have to include commas such as item descriptions would normally break the Localization.txt file format. To avoid that issue, the whole entry must be written inside double quotation marks like in the following example:

"This is one entry in Localization.txt, and this is still the same entry despite being written after the comma! All thanks to being written inside double quotation marks!"

 

3. Each line in Localization.txt file is considered a new line of entries in the table, so what if we wanted to write a pretty item description with paragraphs instead of showing a wall of text with no paragraphs?

 

To write a new line inside our text, we need to write a special mark that will tell the game to put the text that follows on a new line. The mark looks like this:

\n

 

Example:

This will be shown on the first line.\nThis will be shown on the second line.

In game this text will look like this:

This will be shown on the first line.
This will be shown on the second line.

 

If you wanted to leave one or more lines empty, you would have to put two or more of these marks together.

 

Example:

This will be shown on the first line.\n\nThis will be shown on the third line.

In game this text will look like this:

This will be shown on the first line.

This will be shown on the third line.

 

A good rule of thumb is to keep the length of your texts up to 80 characters per line, otherwise your text may show up a little bit broken, not neatly formatted the way you expected. It's because the game seems to put hard-coded line breaks after 80 characters, at least in some cases.

 

That's it for the basics. There are also some advanced things such as tags you can use inside Localization.txt that help you to show some special values that may be changing in game and it will always show the actual values, such as cvars, but honestly I'm not familiar with those yet, I never really had to use them and it's out of scope of this little tutorial point of which was to explain basics.

 

I hope this helps at least some of you to get started writing your first basic localizations for your new awesome mods. I hope you enjoyed it and I wish you good luck with your mods!

  • Like 3
  • Thanks 3

Share this post


Link to post
Share on other sites

Great addition to the tutorial section.  Thanks for your effort!

Share this post


Link to post
Share on other sites

Great stuff here, succinctly explained. Love it.

For returning modders looking to update past work, you might want to note that quest localization no longer has its own file, plus the change to localization being pushed (I think--not playing around with a19 yet).

Share this post


Link to post
Share on other sites

How do you make changes to vanilla Localization in my mod? All I can find is info on adding new items. I made a mod to change crafting perks and I want to modify the Localization in my mod to reflect the changes, but what I have does not change anything.

 Example of the header and one line that I am currently hacking at trying.

 

key,source,context,changes,english,german,latam,french,italian,japanese,koreana,polish,brazilian,russian,turkish,schinese,tchinese,spanish
perkLightArmorRank1LongDesc,progression,perk Agi,"You have started on the path of the lightly armored warrior. Craft quality 3 fair light armor, reduce light armor movement penalty by 15% and stamina penalty by 10%. Improve durability by 50%.\nUnlocks leather armor crafting.",

Share this post


Link to post
Share on other sites
13 hours ago, Quicksilver said:

How do you make changes to vanilla Localization in my mod? All I can find is info on adding new items. I made a mod to change crafting perks and I want to modify the Localization in my mod to reflect the changes, but what I have does not change anything.

 Example of the header and one line that I am currently hacking at trying.

 

key,source,context,changes,english,german,latam,french,italian,japanese,koreana,polish,brazilian,russian,turkish,schinese,tchinese,spanish
perkLightArmorRank1LongDesc,progression,perk Agi,"You have started on the path of the lightly armored warrior. Craft quality 3 fair light armor, reduce light armor movement penalty by 15% and stamina penalty by 10%. Improve durability by 50%.\nUnlocks leather armor crafting.",

Apparently you didn't read the advices I wrote in the OP. Commas between the individual entries are there for a reason! Please refer to the line in vanilla Localization.txt starting with perkLightArmorRank1LongDesc and compare it to your own. The difference is the reason why it didn't work for you.

Share this post


Link to post
Share on other sites

Thank you,

  Do you mean quotation marks? I used commas and quotation marks but I did not understand how the header list related to the body lines.

  I got it working by cutting it down to only the header entries of:

 

Key,File,Type,english,
perkLightArmorRank1LongDesc,progression,perk Agi,"You have started on the path of the lightly armored warrior. Craft quality 3 fair light armor, reduce light armor movement penalty by 15% and stamina penalty by 10%. Improve durability by 50%.\nUnlocks leather armor crafting.",

Edited by Quicksilver (see edit history)

Share this post


Link to post
Share on other sites
15 hours ago, Quicksilver said:

Do you mean quotation marks? I used commas and quotation marks but I did not understand how the header list related to the body lines.

 

This is explained in OP:

On 9/5/2020 at 9:35 AM, mr.devolver said:

Think of the content of Localization.txt as if it was the content of a table. As long as you stick to the vanilla format and follow its rules, you should be fine. Always try to match the vanilla format whenever possible.

 

Your original table didn't work, because the body of the table didn't match the header. It's really that simple, I can't really think of any other way to explain it to you...

 

Again, it's a table with columns and rows, so naturally the body of the table must match the header, not only in sense of the meaning of individual entries, but also in number of entries. The latter is done using commas which are there to let the game know that it's a new entry in the table. If you need to use a comma inside the entry, you have to mark the start and end of the entry with quotation marks like so: "<TABLE ENTRY GOES HERE>", because any comma outside quotation marks is considered a delimiter between table entries.

 

Your new table is also wrong as it's contains a comma after english and the entry with the perkLightArmorRank1LongDesc key also ends with a comma. Why did you leave those commas there? It's unnecessary and doesn't match the vanilla format.

On 9/5/2020 at 9:35 AM, mr.devolver said:

Always try to match the vanilla format whenever possible.

 

I can't stress this enough. You may think that if it works, it doesn't need fixing, but then you will run into other issues if you ignore the way vanilla file is constructed and you will have no clue what went wrong again...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...