


说明:本描述为中英双语版本,中文内容位于英文内容下方。
Note: This description is bilingual. The Chinese section is provided below the English section.
Romestead Localization API is a small dependency mod for Romestead mod authors. It lets mods register localized text through JSON files or embedded C# strings, then reapplies those strings automatically when the game loads or changes language.
locale -> key -> textmod.name and entry.enabled do not conflict between modsI18n.L.Text("mod.name") instead of passing the GUID every timeThis mod is an API/dependency. It does not add gameplay features by itself.
Install it if another mod lists Romestead Localization API as a requirement.
Add a hard dependency and reference RomesteadLocalizationAPI.dll from your project.
using BepInEx;
using BepInEx.NET.Common;
[BepInDependency(RomesteadLocalizationAPI.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BasePlugin
{
public override void Load()
{
I18n.L.RegisterJson(Path.Combine(Paths.PluginPath, "MyMod", "Localization.json"));
}
}
Create a tiny bound localizer class:
using RomesteadLocalizationAPI.Api;
namespace MyMod;
internal static class I18n
{
public static readonly RomesteadLocalizer L =
RomesteadLocalization.For(PluginInfo.PLUGIN_GUID);
}
Single JSON file example:
{
"en": {
"mod.name": "My Mod",
"config.enabled.description": "Master switch for this mod."
},
"zh_CN": {
"mod.name": "我的模组",
"config.enabled.description": "这个模组的总开关。"
}
}
Use text in code:
var name = I18n.L.Text("mod.name");
var count = I18n.L.Text("items.count", itemCount);
Embedded text example:
I18n.L.RegisterTexts(
(RomesteadLocales.English, "mod.name", "My Mod"),
(RomesteadLocales.ChineseSimplified, "mod.name", "我的模组"));
A standalone HTML usage guide is included in the download as usage-guide.html.
enzh_CNzh_TWcs_CZde_DEel_GRes_ESfr_FRit_ITja_JPko_KRnl_NLpl_PLpt_BRru_RUsk_SKsv_SEtr_TR0.25.1_10+If you have any questions or feature suggestions, please submit them through GitHub Issues, or contact me directly at [email protected] or [email protected].
Romestead Localization API 是给 Romestead 模组作者使用的小型依赖模组。它可以让模组通过 JSON 文件或 C# 内嵌字符串注册本地化文本,并在游戏加载或切换语言后自动重新应用这些文本。
语言 -> key -> 文本mod.name、entry.enabled 这类短 key 不会在不同模组之间冲突I18n.L.Text("mod.name"),不需要每次传 GUID这是一个 API/依赖模组,本身不会添加玩法内容。
如果其他模组要求安装 Romestead Localization API,请安装它。
添加硬依赖,并在项目中引用 RomesteadLocalizationAPI.dll。
using BepInEx;
using BepInEx.NET.Common;
[BepInDependency(RomesteadLocalizationAPI.PluginInfo.PLUGIN_GUID)]
public sealed class MyPlugin : BasePlugin
{
public override void Load()
{
I18n.L.RegisterJson(Path.Combine(Paths.PluginPath, "MyMod", "Localization.json"));
}
}
创建一个很小的绑定类:
using RomesteadLocalizationAPI.Api;
namespace MyMod;
internal static class I18n
{
public static readonly RomesteadLocalizer L =
RomesteadLocalization.For(PluginInfo.PLUGIN_GUID);
}
单 JSON 文件示例:
{
"en": {
"mod.name": "My Mod",
"config.enabled.description": "Master switch for this mod."
},
"zh_CN": {
"mod.name": "我的模组",
"config.enabled.description": "这个模组的总开关。"
}
}
在代码中读取文本:
var name = I18n.L.Text("mod.name");
var count = I18n.L.Text("items.count", itemCount);
内嵌文本示例:
I18n.L.RegisterTexts(
(RomesteadLocales.English, "mod.name", "My Mod"),
(RomesteadLocales.ChineseSimplified, "mod.name", "我的模组"));
下载包内包含单独的 HTML 使用教程:usage-guide.html。
enzh_CNzh_TWcs_CZde_DEel_GRes_ESfr_FRit_ITja_JPko_KRnl_NLpl_PLpt_BRru_RUsk_SKsv_SEtr_TR0.25.1_10+如果你有任何问题或新功能建议,请通过 GitHub Issues 提交,或直接通过邮箱 [email protected] 或 [email protected] 联系我。