RomesteadLocalizationAPI
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.
| Last updated | a day ago |
| Total downloads | 2 |
| Total rating | 0 |
| Categories | Mods Libraries |
| Dependency string | Ice_Box_Studio_Romestead-RomesteadLocalizationAPI-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
Romestead_Modding-BepInExPack_Romestead
Romestead-specific BepInEx 6 CoreCLR mod loader. Preconfigured and ready to use.
Preferred version: 0.4.1README
说明:本描述为中英双语版本,中文内容位于英文内容下方。
Note: This description is bilingual. The Chinese section is provided below the English section.
Romestead Localization API (English)
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.
Main Features
- Supports one JSON file for all languages:
locale -> key -> text - Supports multiple JSON files, one language per file
- Supports embedded C# registration for small mods that do not want to ship JSON files
- Automatically scopes keys by the registering mod GUID, so short keys like
mod.nameandentry.enableddo not conflict between mods - Provides a bound localizer object, so mod code can use
I18n.L.Text("mod.name")instead of passing the GUID every time - Reapplies registered strings after the game reloads localization data
- Falls back to English, then Simplified Chinese, then the first available text when the current language is missing
For Players
This 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.
For Mod Authors
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.
Supported Locale Codes
- English:
en - Simplified Chinese:
zh_CN - Traditional Chinese:
zh_TW - Czech:
cs_CZ - German:
de_DE - Greek:
el_GR - Spanish:
es_ES - French:
fr_FR - Italian:
it_IT - Japanese:
ja_JP - Korean:
ko_KR - Dutch:
nl_NL - Polish:
pl_PL - Portuguese (Brazil):
pt_BR - Russian:
ru_RU - Slovak:
sk_SK - Swedish:
sv_SE - Turkish:
tr_TR
Compatibility
- Game version:
0.25.1_10+
Bug Reports & Feature Suggestions
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 Localization API 是给 Romestead 模组作者使用的小型依赖模组。它可以让模组通过 JSON 文件或 C# 内嵌字符串注册本地化文本,并在游戏加载或切换语言后自动重新应用这些文本。
主要功能
- 支持单 JSON 文件管理所有语言:
语言 -> key -> 文本 - 支持多 JSON 文件,每个文件对应一种语言
- 支持 C# 内嵌文本注册,适合不想额外携带 JSON 的小模组
- 注册时自动按模组 GUID 隔离 key,因此
mod.name、entry.enabled这类短 key 不会在不同模组之间冲突 - 提供绑定后的 localizer 对象,模组代码可以写
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。
支持的语言代码
- 英语:
en - 简体中文:
zh_CN - 繁体中文:
zh_TW - 捷克语:
cs_CZ - 德语:
de_DE - 希腊语:
el_GR - 西班牙语:
es_ES - 法语:
fr_FR - 意大利语:
it_IT - 日语:
ja_JP - 韩语:
ko_KR - 荷兰语:
nl_NL - 波兰语:
pl_PL - 巴西葡萄牙语:
pt_BR - 俄语:
ru_RU - 斯洛伐克语:
sk_SK - 瑞典语:
sv_SE - 土耳其语:
tr_TR
兼容性
- 游戏版本:
0.25.1_10+
Bug 提交 & 新功能建议
如果你有任何问题或新功能建议,请通过 GitHub Issues 提交,或直接通过邮箱 [email protected] 或 [email protected] 联系我。