You are viewing a potentially older version of this package. View all versions.
Eepy_Nico_Stuff-TranslationAPI-0.1.0 icon

TranslationAPI

Allows mods to translate text boxes. Does nothing on its own.

Date uploaded a day ago
Version 0.1.0
Download link Eepy_Nico_Stuff-TranslationAPI-0.1.0.zip
Downloads 27
Dependency string Eepy_Nico_Stuff-TranslationAPI-0.1.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305

README

Translations API

BepInEx mod for ULTRAKILL that lets other mods register word/string replacement pairs, applied to every bit of text the game renders through TextMeshPro (HUD, menus, tooltips, subtitles, the cheat menu, etc.). It ONLY Works on TextMeshPros.

  • GUID: com.nico.translationsapi
  • Depends on: BepInEx, HarmonyX (standard ULTRAKILL modding stack)

How it works

Every registered (source, replacement) pair is matched as a substring, anywhere it appears in the text — not whole-word. Replacements are applied in the order they were registered, so a later rule can end up matching text produced by an earlier rule.

"gun"  -> "pew pew"   // "shotgun" becomes "shotpew pew"
"a"    -> "AHHH"      // every lowercase 'a' becomes "AHHH"
" "    -> ""          // strips every space

If two mods register the same source string, the most recently registered one wins, and a warning is logged to the console so conflicts are easy to spot.

Usage (for mod authors)

Add a reference to TranslationsAPI.dll, and in your plugin's BepInDependency:

[BepInDependency("com.nico.translationsapi")]

Then register your replacements, typically in Awake():

using TranslationsAPI;

TranslationRegistry.RegisterTranslation("gun", "pew pew");
TranslationRegistry.RegisterTranslation("a", "AHHH");
TranslationRegistry.RegisterTranslation(" ", "");

To remove a registered translation:

TranslationRegistry.UnregisterTranslation("gun");

API reference

Method Description
RegisterTranslation(string source, string replacement) Registers a replacement. Ignored (with a warning) if source is null/empty. Overwrites an existing registration for the same source (last wins), logging a warning.
UnregisterTranslation(string source) Removes a previously registered translation. No-op if it wasn't registered.

Known limitations

  • Only text set through TMP_Text.text is caught. If some UI element in ULTRAKILL doesn't go through TextMeshPro, it won't be affected.
  • Substring matching means short/common sources (like "a" or " ") will match very aggressively — that's by design, but worth knowing before you register something too broad.