Table of Contents

Class LocaleLoadingEvent

Namespace
MonkeyLoader.Resonite.Locale
Assembly
MonkeyLoader.Resonite.Integration.dll

Represents the event data for the Locale Loading Event.

public sealed class LocaleLoadingEvent : AsyncEvent
Inheritance
LocaleLoadingEvent
Inherited Members

Remarks

By default, the locale data provided by mods in their FileSystem is injected into the loading process of the LocaleResource asset by the predefined FileSystemLocaleLoader.

Data files are automatically loaded from any mods that provide them.
To be considered for loading, locale data files have to be in any folder called Localeanywhere in a mod's content files. Multiple Locale folders with files for the same locale are no problem.

Locale data files need to have their language code as their filename, for example: de-at.json for austrian german, or de.json for any german.
The locale definitions are loaded with the exact locale code (de-at) coming first, falling back to the base locale code (de), and finally the universal fallback english (en).
All locale keys will use the first definition encountered for them: A key that's the same for de-at and de would not have to be present in de-at, while a different one in de-at would take priority over the one in de.

The json files need to be in the following format (for en.json here), although the ModId-prefix is just convention:

{
  "localeCode": "en",
  "authors": [ "Mod", "Locale", "Author", "Names" ],
  "messages": {
    "ModId.KeyA": "A first message.",
    "ModId.KeyB": "Better locale support!"
  }
}

Properties

Last

Gets whether this is the last locale code being queried for the current locale loading process.

public bool Last { get; }

Property Value

bool

LocaleCode

Gets the locale code that data should be loaded for.
No processing needs to be done on this, fallbacks create their own events.

public string LocaleCode { get; }

Property Value

string

LocaleResource

Gets the Elements.Assets.LocaleResource instance that new locale authors and keys should be added to.

public LocaleResource LocaleResource { get; }

Property Value

LocaleResource