Localizing Strings in Daggerfall Unity – Part 1
Localizing Strings in Daggerfall Unity – Part 2
Localizing Strings in Daggerfall Unity – Part 3
Localizing Strings in Daggerfall Unity – Part 4
Localizing Strings in Daggerfall Unity – Part 5
In Part 1, we setup the string tables to receive our localized text. In Part 2, we imported strings to configure initial data for each locale with either English text or legacy translations from TEXT.RSC.
Before we edit a few strings into their respective language, we’re going to set all string tables to preload. This means their data is fully loaded sooner and region switching will be faster later in this tutorial. This is recommended when creating translation mods.
- Click Window menu > Asset Management > Localization Tables to open string editor.
- Drop-down Selected Table Collection and select Demo_Strings (StringTable).
- Click the metadata button above any of the string tables and put a tick in Preload All Tables. This will automatically select Preload Table for every locale.
- Repeat steps 2-3 for Demo-RSC (StringTable)
With that out of the way, let’s take a closer look at the string table and make our first edits.
The left-hand column of string table holds the unique key each for item. This key is how Daggerfall Unity looks up a string for any language. Never change the key value or this will break string lookup in-game.
Then for each language, there is a value field which contains data for that key. All languages share the same key, only the value needs to be translated.
Note: Daggerfall Unity will occasionally add new keys and values which must also be added to your translation mod. Syncing new keys to maintain your mod will be covered in a future tutorial in this series.
We’re now going to change the value of pleaseSelectYourHomeProvince for each locale. This is one of the first strings seen when starting a new character, and also near the top of list, so it’s a good place to start. Copy and paste the following text into each locale’s value field next to the pleaseSelectYourHomeProvince key.
Czech (ch) : Vyberte svou domovskou provincii…
French (fr) : Veuillez sélectionner votre province d’origine…
German (de) : Bitte wählen Sie Ihre Heimatprovinz…
Korean (ko) : 거주 지역을 선택하십시오…
Note: Translations were created using Google Translate.
Once this is completed, your string table should look like below (click for full size).
You can now close the Localization Tables editor.
Setting Play Mode Script
Before we take a look at these translations in-game, we’re going to check the Play Mode Script for addressables in Unity. We won’t go into this in detail, but we need to ensure the correct setting is selected before proceeding.
- Click Window menu > Asset Management > Addressables > Groups
- Click Play Mode Script and confirm Use Asset Database (fastest) is selected
- Close the Addressables Groups UI
The Play Mode Script is how Unity will load addressable assets like string tables during play. For simplicity and speed, we will only select Use Asset Database (fastest) in this tutorial. This is also the default setting.
Assign String Tables To TextManager
The final step to see our translations in-game is to tell Daggerfall Unity how to load our translated assets.
You should already have the DaggerfallGameScene open from Part 2. If not, locate this scene in Project view under Assets/Scenes and open it now.
Locate and select the TextManager component then look to the Inspector view. We must now change the Live String Tables to reference our custom translations instead of the default English language in core game. Make the highlighted edits in below screenshot.
The names Demo_Strings and Demo_RSC match the two string table collections we created back in Part 1. Changing these settings will redirect string lookups to our custom string tables.
To quickly summarise the purpose of each string table collection:
- Internal Strings – Are all strings previously extracted from FALL.EXE and other hardcoded locations. Their key is in plain text and represents the text being translated.
- RSC Strings – Are all strings extracted from TEXT.RSC. Their key is a numeric value matching an ID in TEXT.RSC.
- BOK Strings – Will be all strings extracted from books in game data. This is under development and will be available in a future release of Daggerfall Unity.
To quickly recap everything we’ve done so far:
- Setup Unity 2019.4.10 and cloned the full Daggerfall Unity project
- Created empty string table collections Demo_Strings and Demo_RSC.
- Imported initial text to populate our two new string table collections, using legacy translations from French and German TEXT.RSC, and remapped back to correct character codes.
- Set all string tables to preload.
- Translated string values for “Please select your home province…” into multiple languages.
- Set the Play Mode Script to Use Asset Database (fastest).
- Opened the DaggerfallUnityGame scene.
- Assigned our string table collection to Live String Tables in TextManager inspector.
Click Play button to start the game. Because we have the DaggerfallUnityGame scene open, it will open straight to the title menu. Just click to dismiss any videos that play at startup.
Once game has started, take note of the language dropdown towards top-right of play window.
Note: Depending on your locale settings, you might have another language other than English (en) above.
Whatever your language is, use this dropdown and change the selected locale to French (fr). Then click Start New Game. If everything is working properly, you should see our translated text in French.
Note: There might be a short delay when Unity first preloads string data. You may need to click Start New Game twice after changing language.
Now press Escape key to return to title menu and change language to German (de). Click Start New Game again and the text should now be in German.
Finally, press Escape key back to title menu again, then change language to Korean (ko) and click Start New Game.
So what’s gone wrong here? Why are we seeing question marks? Everything looked OK when creating the translated string in the editor.
These question marks indicate Daggerfall Unity was unable to locate font characters matching one or more codes in source text. The default fonts in Daggerfall Unity have a full complement of Latin characters, but they do not have characters for non-Latin languages. When the game attempts to render these unknown characters, it will display question marks instead.
To fix this, we need to provide new fonts with locale-specific characters to Daggerfall Unity. Fonts will be covered in a future tutorial in this series.
We have a little more ground to cover first in Localizing Strings in Daggerfall Unity – Part 4.