Help、Hint 与 Bindings.Lang
绑定帮助的三层结构
MatrixShop 当前命令帮助和绑定提示可以来自三类字段:
Help-KeyHint-KeysHelp
其中:
Help-Key适合一行描述,通常引用全局语言键Hint-Keys适合给特定动作提供说明键,例如open、amountHelp适合多行补充说明
Bindings.Lang
从 1.8.0 开始,Bindings 支持同级 Lang 语言覆盖:
Bindings:
Commands:
- "trade"
Help:
- "&7Open the trade center."
Lang:
zh_CN:
Help:
- "&7打开交易中心。"
en_US:
Help:
- "&7Open the trade center."
也支持 route 级覆盖:
Routes:
open:
Action: transaction.open
Bindings:
- "open"
Lang:
zh_CN:
Help-Key: "@commands.help.desc.transaction-open"
en_US:
Help:
- "&7Open the trade view."
解析优先级
当 MatrixShop 生成帮助或提示时,优先级固定为:
Bindings.Lang.<sender-locale>- 归一化后的 locale,例如
en_gb -> en_US - 普通
Help-Key/Hint-Keys/Help - 全局
Lang/*.yml
这意味着:
- 没有
Bindings.Lang时,旧行为不变 - 只给某个语言补覆盖也没问题
- 覆盖值既可以写纯文本,也可以继续写
@lang-key
Help-Key
示例:
Help-Key: "@commands.bindings.cart"
适用于:
/ms help/cart help- 模块帮助中的一行描述
Hint-Keys
示例:
Hint-Keys:
open: "@commands.bindings.cart"
amount: "@commands.hints.cart-amount"
不同模块会按需要读取不同动作键,例如:
openamountrequestmoneyexp
Help
多行帮助支持列表或块字符串:
Help:
- "&7Open the cart."
- "&7Adjust amount with the cart amount action."
或:
Help: |-
&7Open the cart.
&7Adjust amount with the cart amount action.
推荐实践
- 通用说明优先写在普通
Help/Help-Key - 只有在某个绑定需要特别的本地化文案时,再增加
Bindings.Lang - 不要把普通菜单标题、按钮名、物品 lore 混进
Bindings.Lang;它只负责绑定相关文案