Creating multilingual mod EN - Drova-Modding/Drova-Modding-API GitHub Wiki

Subject to Change

Later it will be possible to register it ahead of time and with jsons or your own custom .loc files.

Register your translations

Trough code

To register your translations you need to override OnSceneWasLoaded in your Core class of the MelonMod. When the main menu was loaded, we can register our languages into their system and are able to request our translation.

public const string MainScene = "Scene_MainMenu";

public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
    if (sceneName == MainScene) {
        LocalizationAccess.CreateLocalizationEntries(
        [
             new("Hello", "Hallo", Il2CppCustomFramework.Localization.LocalizationDB.ELanguage.de),
             new("Hello", "Hello", Il2CppCustomFramework.Localization.LocalizationDB.ELanguage.en),
             new("Hello", "Bonjour", Il2CppCustomFramework.Localization.LocalizationDB.ELanguage.fr),
        ], "ExmapleMod");
    }
}

Trough Folder

For that you need to create a file structure under the folder "Modding_API" image Followed than by "Localization" and afterwards you need to use the language short names, such as "de" and "en" image Those will be automatically registered as soon as the main menu is loaded

The files need to look like this: image Important is to also add "_de" to the filenames, when you are in the "de" localization folder. The same principle is also important for "_en" in the "en" localization folder

And you can access at runtime with

string yourTranslationInTheCurrentLanguage = LocalizationAccess.GetLocalizedString("ExampleMod", "Hello").GetLocalizedString(null);