Skip to content

Translating Daggerfall Unity

Gavin Clayton edited this page Dec 13, 2023 · 3 revisions

Getting Started

To create translations for Daggerfall Unity, you’ll need the following to get started:

  1. A working setup of Daggerfall Unity. Setting up using the DaggerfallGameFiles method is recommended, but you can also use Steam release to get started.
  2. A CSV editor such as Microsoft Excel or Google Sheets. You also can use any good text editor, but it’s more convenient to use a dedicated spreadsheet or CSV tool. Whichever tool you use, always ensure your files are saved in UTF-8 format, never ANSI or something else.
  3. A suitable TTF or OTF font representing your alphabet. The built-in fonts have a full complement of Latin characters, but you’ll need to provide a font with the appropriate characters for whatever dialect of Kanji, Cyrillic, Hangul, etc. you are writing in.
  4. A way of extracting ZIP files and creating new ZIP files to distribute your translations. This functionality is built into Windows and other major operating systems.

Throughout this whole process, we’ll be placing files somewhere in the DaggerfallUnity_Data\StreamingAssets folder. Start by locating the below path in your Daggerfall Unity installation.

image

Selecting Fonts

If you’re writing translations using Latin characters (e.g. English, French, Italian, Spanish), you can skip this section. The built-in Daggerfall Unity fonts contain a full complement of Latin characters. But if you still want to assign a new font for other reasons, then keep reading.

You will need to supply a TTF or OTF font representing all the Unicode characters required for your alphabet. Daggerfall Unity uses standard Unicode codes for all text. If any characters are missing from your font, these will not display correctly in game.

Rather than use any specific language or dialect, this tutorial will use pseudo localization (e.g. ƥƨèúδô ℓôçáℓïƺáƭïôñ) to demonstrate how to setup your custom font and alphabet file so the correct characters are imported. I’ll be using the versatile NotoSans-Regular font to demo this process.

Tip: When selecting your own font, try to pick something that also contains a full complement of Latin characters. This is important so any untranslated parts of your work will still display correctly in default English. NotoSans is a great font family for testing as it has versions which contain glyphs for almost every alphabet.

Replacing Fonts

Once you’ve selected your fonts, you’ll first need to copy them into a place where Daggerfall Unity can find them and rename font files so the runtime knows to use them.

In below screenshot, I’ve copied NotoSans-Regular.ttf into StreamingAssets/Fonts and renamed file to FONT0003-SDF.ttf.

image

This informs DFU to use the selected font to replace FONT0003, which happens to be the font used for most general text in the game. Repeat for any other fonts as needed.

Tip: All fonts must be TTF or OTF with standard Unicodes. The legacy 8-bit pixel fonts (FNT) are not suitable for writing translations and can be ignored. Font rendering will be forced into SDF mode to display translations correctly.

Editing CSV Files

To get started on translating Daggerfall Unity, a master set of CSV files in English are included in StreamingAssets/Text/Master Localization CSV Files.

image

To use one or more or these files, copy the master file into StreamingAssets/Text and edit with your language changes.

image

To translate text, simply open CSV file in a spreadsheet program, rewrite the text in a cell, then save and run game to test.

Example below uses Excel to edit a string in Internal_Strings and change the Value field in row 3.

image

Tip: Never change the contents of Key column. This is how the game knows which text your translation should map to. Only change text in Value column.

Save file and run the game, then you'll see translation in place of the original text.

image

RSC Markup

In some CSV files, you’ll note there are markup codes enclosed in [square brackets] and variables starting with a % symbol. Example below from Internal_RSC.

image

When translating this text, do not translate the markup codes in [square brackets] or variables preceded by a %. Here’s an example pseudo translation of above. Note that markup like [/center] and macro variables like %ark are not translated.

image

After saving this text and restarting game, translation is active with formatting and variables intact.

image

Tip: Depending on your language, you might need to add additional line breaks or formatting to ensure all text fits in the available space.

That’s the most technical aspect of writing translations out of the way. As a general rule, just follow the usage in the Master CSV files and you should be able to translate everything over time.

Now that you know how to add fonts and translate text, the following pages will individually cover the major game systems where text is found.

Building Names

Note: It is now possible to override the building name generation using a FormulaHelper.GenerateBuildingName() override. This override will need to be written in C# and distributed in a .dfmod along with your other translations, but allows for custom generation rules suiting any language.

Building names are composed using Part A and Part B components found in Internal_Strings starting from row 901. See this article for a more detailed explanation of how Daggerfall creates building names from a seed.

This text is exposed as-is. You’ll need to translate building name parts so these makes sense to your language’s grammar rules. Example below in pseudo localization.

image

image

image

Locations

Unlike building names, location names are not procedurally generated from seed. These are simply string literals in MAPS.BSA inside Daggerfall’s game data. This data is a combination of bespoke names and many randomly generated names created at development.

This text is exposed as-is in Internal_Locations. You can use whatever process works best for your language to translate location names. Connecting your spreadsheet to a translation API might help you bulk translate the names, followed by hand-tuning as necessary.

image image

Quests

Quests use a text-based file format with QRC (text) and QBN (logic) parts. To translate quests, copy files from StreamingAssets/Quests into StreamingAssets/Text/Quests folder and append -LOC to filename.

image

Then open text file and translate strings in QRC section. Be careful not to change any markup or data strings. Examples of these kinds of string in quests are <--> (separator for alternate/random text blocks), (center format token), Message: 1031 (starts message data), %pcn (a macro).

image

image

Tip: You can delete the whole QBN: section from translated quest files to save space. This is never read from translated quest files. The logic part of quests is always read from the source quests location in StreamingAssets/Quests.

Books

In Daggerfall Unity versions prior to 0.15, books were converted at runtime from classic BOK*.txt format. This has drawbacks such as books containing formatting errors and not supporting Unicode characters.

From version 0.15 and later, books are included in the StreamingAssets/Text/Books folder using a new text format compatible with localization system. This enables Unicode characters for books and opens fixes to book spelling, grammar, and formatting via open source pull requests.

To edit a book, locate the book file in StreamingAssets/Text/Books and translate the contents. As covered earlier, don’t translate any markup content such as [/font] or [/center].

Below is a the beginning of The Faerie (BOK00006-LOC.txt). The file names are the same as classic, except with -LOC appended. Internally these files are in a new format.

image

The tags at start of book file contain data about that book. Some of this data is visible in-game e.g. Title:. Some tags control how book is released e.g. WhenVarSet: prevents book from being available until after a global variable is raised. Don’t translate the tags themselves or any non-text values (e.g. numbers, True/False). Translating text values like the title is OK.

To translate, edit the book contents as we did earlier then save file and restart game. Following is an example pseudo translation of above.

image

The translated book now displays in game as below. Title, author, tooltips, and content are all translated.

image

image

Note: The default title font is missing some characters that display as a ? instead. This is because the title font does not contain a matching Unicode character for these glyphs. Replacing the title font with one containing these Unicodes will correct problem.

Book Images

Books files can also reference images placed in StreamingAssets/Text/Books/BookImages folder. In this example, an image is saved into this folder as test1.jpg.

image

It is then added to book directly below title using the [/image={filename}] markup like so.

image

The added image displays in-game when player opens book.

image

Note: Book images are always scaled and centred on their own line. At time of writing, there’s a bug where book image is not properly clipped to scroll area.

Book Scaling and Colours

It’s also possible to adjust book scaling and colours using the [/color={RGBHex}] and [/scale={value}] markup like so.

image

This changes the colour and scale of the first paragraph. Like other formatting, colour and scale reset at every newline. The untranslated portion of book follows the first paragraph.

image

Biography Text

Biography text can be edited directly in StreamingAssets/BIOGs. In below example, one of the questions and answers in BIOG00T0.txt (e.g. Mage class) have been translated.

Note: It is very important not to translate the non-text parts or formatting of this file. Incorrect changes can crash the game or cause other problems.

image

This will display in-game like below.

image

Faction Text

Edit the canonical name of factions and NPCs using the Internal_Factions.csv file in StreamingAssets/Text.

image

image

Menus

Menu text can be edited directly in StreamingAssets/Text. These are special CSV data files, but still in the format key, value. As fonts are loaded earlier than mods, it’s now possible to translate menu text. An example below.

Note: The key is not changed, only the text value.

image

image

Images, Sounds, and More

It’s also possible to translate menu image, sounds, and more using loose files in StreamingAssets. This is beyond the scope of this article. See Daggerfall Unity Modding System as a starting point.

Distributing Translations

As translations are just a collection of loose files spread throughout StreamingAssets, they can be distributed as a zip file. After testing, bundle all your changed text files into a single .zip archive with correct paths and release.

The end user then needs only unzip whole archive into StreamingAssets while keeping paths so everything goes into the correct folder.

Please consider the source text files can change over time. It will become necessary to maintain your translation mod to ensure it remains compatible with new versions of Daggerfall Unity.

Get Help

A few teams have been through the process of translating Daggerfall Unity now, and you can learn from their work. Daneel53 from the French translation has kindly posted an augmented tutorial that covers their process in great detail.

https://forums.dfworkshop.net/viewtopic.php?p=66738#p66738

The Translation area of the forums is also a great place to ask for help from the international community.

Conclusion

As of Daggerfall Unity 0.15, its now possible to translate the game using simple font and text files distributed as a .zip archive. It’s no longer necessary to use Unity Editor or package a .dfmod. Simply edit the required text files and distribute in a .zip archive.

Almost the entire game can be translated at time of writing, with some limitations. Notably, it’s not yet possible to translate random name banks and faction names require a new game to take effect. Also, editing some files incorrectly can break the game if file edited incorrectly. These limitations will hopefully be improved in future releases.

I hope this article proves useful to Daggerfall Unity players around the world. Best of luck to everyone working on translations!