Server I18n API (Reborn) 图标

Server I18n API (Reborn)

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 2.0.0-beta.1
本资源为搬运资源,原资源地址: https://modrinth.com/mod/server-i18n-api-reborn
资源信息

Minecraft 版本: 26.1 26.1.1 26.1.2

平台: fabric neoforge

标签: library

资源介绍

Server I18n API (Reborn)

This is a server-side only mod API to provide I18n for server-side only mods.

Language detection is automatic when sending message to player(s).

Upstream: CodeOfArdonia/ServerI18nAPI

This is a fork of Server I18n API for 26.1+ support.

Guide for developers

You need to put language JSONs in data/<mod id>/lang/<language>.json, filling in key-value pairs. Lang files in assets folders are ignored by ServerI18n.

API: ServerI18n.java class.

Examples:

// 1. Translate a key into a specific player's language with positional arguments
String msg = ServerI18n.translate(player, "chat.welcome", "Steve", 5);
// player's language (e.g., "zh_cn") -> "欢迎回来, Steve! 你有5条新消息。"

// 2. Send a translated system message to the command source (player or console)
ServerI18n.sendMessage(stack, "foo.command.success", "backup.zip");
// If stack is a player, uses their language; otherwise falls back to en_us.

// 3. Get raw translation without applying String.format (e.g., for custom formatting)
String raw = ServerI18n.translateRaw("fr_fr", "bar.gui.button.confirm");
// raw = "Confirmer" (if exists), otherwise fallback to en_us or the key itself.

// 4. Broadcast a message to all online players using the server instance
ServerI18n.broadcast(server, "announcement.maintenance", "10:00", "12:00");
// Each player receives the message in their own language.

// 5. Use default language (en_us) explicitly for console or fallback
Component comp = ServerI18n.translateToLiteralDefault("baz.error.file_not_found", "config.yml");
// comp is a literal Component with English text: "File not found: config.yml"
下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Hardcore Revival Items

价格:0 墨喵币
下载量:0

查看详情
Darkness CPVP

价格:0 墨喵币
下载量:0

查看详情
The Angel of Immortality

价格:0 墨喵币
下载量:0

查看详情
looshy pink overlay

价格:0 墨喵币
下载量:0

查看详情