
Resonite
You are viewing a potentially older version of this package. View Latest Version

A Resonite mod that Loads locale files for Plugins.
ResoniteModding-BepisLocaleLoader-1.0.0.zip) from the Releases page.plugins folder to your BepInEx folder in your Resonite installation directory:
C:\Program Files (x86)\Steam\steamapps\common\Resonite\BepInEx\You can register a single localized string in code with:
LocaleLoader.AddLocaleString(
"Settings.BepInEx.Core.Config",
"Reset Configuration",
force: true,
authors: "YourName"
);
rawString → The key used to look up the string.localeString → The localized text to display.force → If true, always overwrites existing entries.authors → Optional, comma-separated string of authors. Defaults to plugin authors or "BepInEx".Place a Locale folder next to your plugin DLL (e.g. MyPlugin/Locale/en.json).
Files should follow the LocaleData JSON structure:
{
"localeCode": "en-US",
"authors": ["MyName"],
"messages": {
"Settings.MyPlugin.Option": "Enable Feature",
"Settings.MyPlugin.Description": "This feature toggles something cool."
}
}
Load all locale files from a plugin with:
LocaleLoader.AddLocaleFromPlugin(myPluginInfo);
Or load a single JSON file manually:
LocaleLoader.AddLocaleFromFile("path/to/Locale/en.json");
.T()To make localization calls cleaner, LocaleLoader defines extension methods .T() that wrap AsLocaleKey and LocaleString.
Examples:
// Basic key lookup
"Settings.MyPlugin.Option".T();
// Key with formatting arguments
"Settings.MyPlugin.Welcome".T("Hello {name}!", "name", userName);
// Multiple arguments
"Settings.MyPlugin.Stats".T(
("kills", killCount),
("deaths", deathCount)
);
// With format string
"Settings.MyPlugin.Formatted".T("{kills}/{deaths}",
("kills", killCount),
("deaths", deathCount)
);
// Continuous locale updates (useful for dynamic UI)
"Settings.MyPlugin.Timer".T(
continuous: true,
arguments: new Dictionary<string, object> { { "time", elapsedTime } }
);
force: trueforce: false (default) when you want to avoid overwriting existing locales (safe for mods adding only new keys).force: true when your plugin should override existing translations (e.g. testing, fixes, or ensuring your text is applied).LocaleLoader.PluginsWithLocales.