Skip to content

Translate your mod

Copy one file into your mod and wrap your player-facing strings. Players can then translate every line.

You need: a MelonLoader mod project (IL2CPP net6 or Mono netstandard2.1).

  1. Copy L10n.cs into your project. It needs only MelonLoader and UnityEngine.CoreModule. The class is internal, so several mods can each carry a copy without a clash.

  2. Wrap each player-facing string in L10n.T. The English text is the key.

    using DooDesch.Localization;
    entry.Title = L10n.T("Ask the motel manager about the RV");
    npc.SendWorldSpaceDialogue(L10n.T("Yeah, I can fix it. Fifty grand."), 5f);
  3. Turn strings with runtime values into format strings.

    choice.Text = L10n.T("Pay ${0}", fee); // was: "Pay $" + fee

    Wrap only what players see: dialogue, quest titles and objectives, item names and descriptions, HUD text. Keep log lines in English.

  4. Optional: register a built-in table per language in OnInitializeMelon, before anything calls T().

    L10n.Register("de", new Dictionary<string, string>
    {
    ["Ask the motel manager about the RV"] = "Frag die Motel-Managerin nach dem Wohnmobil",
    ["Pay ${0}"] = "{0} $ zahlen",
    });
  5. If you find a quest by its title, keep the title in ONE field and use it for both create and find.

    internal static readonly string Title = L10n.T("Back on the Road");

T() returns an unknown key unchanged. A mod without tables stays English.

Start the game once. The file UserData/DooDesch/Localization/<YourModAssembly>/_template.en.json appears with every key from your registered tables. Register at least one full table, or the template stays incomplete.

  • Language: the shared [DooDesch] Language preference, else the OS language, else English. It is resolved once per session, so a language change needs a restart.
  • Overlay order, later wins per line: your built-in table, then translation mods in Mods/Localization/<YourModAssembly>/<code>.json, then the player’s file in UserData/DooDesch/Localization/<YourModAssembly>/<code>.json.
  • Keys that start with _ (like _readme in the template) never match a source string. Use them for comments in JSON.
  • If you reword an English string in code, its key in your tables and in players’ files no longer matches. That line falls back to English. Search your tables for the old text.