Daggerfall Unity 0.10.26 Localization Preview

Discuss Daggerfall Unity and Daggerfall Tools for Unity.
Post Reply
User avatar
Interkarma
Posts: 5842
Joined: Sun Mar 22, 2015 1:51 am

Daggerfall Unity 0.10.26 Localization Preview

Post by Interkarma »

Daggerfall Unity 0.10.26 Localization Preview will be available in a couple of weeks. This version introduces back-end features required to support translation mods. For more detail and upcoming tutorials, please refer to the topic in Translations forum below (under construction).

viewtopic.php?f=26&t=3919

Rather than go over all that in two places, I want to quickly summarise changes that might impact core developers now. This all relates to text in the base game so probably won't affect modders, but worth taking a quick look below just in case. End users don't need to do anything special, please just report missing or broken text strings if you find any.

The following text sources have been removed:
  • HardStrings.cs hardcoded strings (now just storing some keys).
  • ClassicEffects.txt
  • ConversationText.txt
  • DaggerfallUI.txt
  • GeneralText.txt
  • Races.txt
  • SpellmakerUI.txt
  • TextProvider.cs hardcoded strings (monster names, material names, skill names)
The above is a combination of hardcoded string literals in C# files and text tables in StreamingAssets/Text. It's basically all text from FALL.EXE and strings unique to DFU.

This text has been moved into a Unity Localization StringTable called Internal_Strings.

I've exposed Localization system through the TextManager singleton and kept everything as similar as possible to use. For example, the below text lookup changes from:

Code: Select all

TextManager.Instance.GetText("ClassicEffects", "elementalResistance");
Into:

Code: Select all

TextManager.Instance.GetLocalizedText("elementalResistance");
The magic effect system required some refactoring to support switchable locales. Instead of caching text items like spell book description into a data struct at startup, this is now accessed as-needed from class Properties that each effect must implement. So instead of:

Code: Select all

properties.GroupName = TextManager.Instance.GetLocalizedText("climbing");
properties.SpellMakerDescription = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(1578);
properties.SpellBookDescription = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(1278);
This becomes:

Code: Select all

public override string GroupName => TextManager.Instance.GetLocalizedText("climbing");
public override TextFile.Token[] SpellMakerDescription => DaggerfallUnity.Instance.TextProvider.GetRSCTokens(1578);
public override TextFile.Token[] SpellBookDescription => DaggerfallUnity.Instance.TextProvider.GetRSCTokens(1278);
GetRSCTokens() method is now localization aware and can grab translated RSC text from a custom StringTable or fallback to TEXT.RSC. The default English game will continue using TEXT.RSC for a while yet. GetRSCTokens() is likely be moved into TextManager for consistency later.

I've already done the work of migrating everything in core game to StringTables and refactoring where needed. No work should be needed in mods unless you have some touch on the text sources listed above.

I recommend core devs take a look at the Unity Addressables and Localization stuff. There are a few gotchas when creating new local builds. I'll cover this in more detail in Translation topic in near future.

User avatar
Interkarma
Posts: 5842
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity 0.10.26 Localization Preview

Post by Interkarma »

Flagging another change that could impact mods, this time for potions. Rather than setting DisplayName of potion at startup, a new PotionRecipe now sets DisplayNameKey. This key is used to lookup potion name from active localization table as required. This fixes "Potion of <LocaleText-NotFound>" and allows for potion names translations to be switched at runtime.

The DisplayName property is retained for backwards compatibility. This now just looks up display name using the key above. If key is null or empty, then "Unknown Powers" is returned. Moved "Unknown Powers" text to localization string tables.

See link below for full PR with all changes.

https://github.com/Interkarma/daggerfal ... da66b2af92

User avatar
pango
Posts: 2605
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Daggerfall Unity 0.10.26 Localization Preview

Post by pango »

Hi Interkarma,

Any plans or ideas for making DialogShortcuts.txt overridable for localization purposes?
I imagine that a locale could come with several named layouts, based on different keyboard layouts or simply different keyboard shortcuts schemes, one of the layouts (say the first one) being the default...
But I don't know how that would fit in the localization implementation...
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Interkarma
Posts: 5842
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity 0.10.26 Localization Preview

Post by Interkarma »

Being in StreamingAssets, a translation mod could provide replacement shortcut files for users with various keyboard layouts.

We could also supply a method for a scripting mod to register a new bindings file at startup based on whatever conditions mod checks for. But users might also like to customise this one themselves, so a mod forcing new shortcuts isn't quite ideal either.

I don't feel this is a good candidate for compiled text assets, it's much more functional in plain text table format. It sits a bit oddly between localisation and user settings.

Post Reply