Zaphkiel 内置国际化支持,让你的服务器能够为来自世界各地的玩家提供母语化的物品体验。
系统会根据玩家的客户端语言设置,自动显示相应语言的物品名称、描述和交互信息。
- 🌐 全球化支持 - 覆盖 Minecraft 支持的所有语言区域
- 🔍 自动检测 - 无需手动设置,系统自动识别玩家语言
- 🛡️ 容错机制 - 缺少翻译时自动显示默认语言内容
- 📋 全方位本地化 - 物品名称、词条内容、交互事件均可本地化
- ⚙️ 配置简单 - 通过标准 YAML 格式管理所有语言版本
使用 i18n 节点组织不同语言的内容:
plugins/Zaphkiel/item/def.yml healing_potion:
display: potion_display
icon: potion
# 默认语言内容
name:
item_name: '&aHealing Potion'
lore:
item_category: '&7Consumable'
item_effect: '&fRestores health'
event:
on_use: |
tell 'Health restored!'
# 多语言内容
i18n:
zh_cn:
name:
item_name: '&a治疗药剂'
lore:
item_category: '&7消耗品'
item_effect: '&f恢复生命值'
event:
on_use: |
tell '生命值已恢复!'
根据 Minecraft Wiki 语言标准,支持的语言代码包括:
| 代码 | 语言 | 地区 |
|---|
zh_cn | 简体中文 | 中国 |
zh_tw | 繁体中文 | 中国台湾 |
en_us | English | United States |
ja_jp | 日本語 | 日本 |
ko_kr | 한국어 | 대한민국 |
fr_fr | Français | France |
de_de | Deutsch | Deutschland |
es_es | Español | España |
pt_br | Português | Brasil |
ru_ru | Русский | Россия |
为物品的各种属性提供多语言版本:
plugins/Zaphkiel/item/def.yml i18n:
fr_fr:
name:
item_name: '&bÉpée Magique'
item_rarity: '&6Légendaire'
lore:
item_type: '&9Arme'
item_power: '&fPuissance élevée'
usage_hint:
- '&7Clic droit pour attaquer'
- '&7Durabilité: 100/100'
为玩家交互提供本地化反馈:
plugins/Zaphkiel/item/def.yml i18n:
de_de:
event:
on_attack: |
tell '&cKritischer Treffer!'
tell '&7Schaden: +15'
on_break: |
tell '&4Waffe ist zerbrochen!'
on_repair: |
tell '&aWaffe wurde repariert'
内容选择顺序:
- 第一优先:玩家客户端语言对应的 i18n 翻译
- 第二优先:默认语言内容(根节点配置)
- 保障机制:确保所有玩家都能看到可理解的内容
Q: 翻译没有生效怎么办?
A: 检查语言代码格式是否正确,确保使用下划线而非连字符(如 zh_cn 而非 zh-cn)
Q: 玩家切换语言后物品没变化?
A: 这是正常现象,已有物品会在下次更新时切换语言,新物品会立即使用新语言
Q: 可以只翻译部分内容吗?
A: 可以,未翻译的部分会自动使用默认内容
Q: 如何确认玩家使用的语言?
A: 系统会自动检测,无需手动干预
plugins/Zaphkiel/item/def.yml dragon_slayer:
display: legendary_weapon
icon: diamond_sword
# 英文默认
name:
weapon_name: '&4Dragon Slayer'
weapon_grade: '&6Legendary'
lore:
weapon_type: '&9Two-Handed Sword'
weapon_lore:
- '&fForged in dragon fire'
- '&fDeals extra damage to dragons'
weapon_stats:
- '&a+100 Attack Damage'
- '&a+25% Critical Strike'
event:
on_kill_dragon: |
tell '&6The dragon falls before your blade!'
give experience 1000
# 多语言版本
i18n:
zh_cn:
name:
weapon_name: '&4屠龙者'
weapon_grade: '&6传说'
lore:
weapon_type: '&9双手剑'
weapon_lore:
- '&f在龙火中锻造而成'
- '&f对龙类造成额外伤害'
weapon_stats:
- '&a+100 攻击伤害'
- '&a+25% 暴击率'
event:
on_kill_dragon: |
tell '&6巨龙倒在了你的剑下!'
give experience 1000
ja_jp:
name:
weapon_name: '&4ドラゴンスレイヤー'
weapon_grade: '&6伝説'
lore:
weapon_type: '&9両手剣'
weapon_lore:
- '&fドラゴンの炎で鍛えられた'
- '&fドラゴンに追加ダメージ'
weapon_stats:
- '&a+100 攻撃力'
- '&a+25% クリティカル'
event:
on_kill_dragon: |
tell '&6ドラゴンがあなたの剣の前に倒れました!'
give experience 1000