Textualizer
一个简单的本地化管理库。
为模组开发者提供了针对 Minecraft 的特定实现,封装了 Minecraft 自身的本地化系统。
给开发者
设置
你需要将其作为依赖项添加到你的 build.gradle(.kts) 文件中。
repositories {
maven("https://maven.deftu.dev/releases")
}
dependencies {
modImplementation("dev.deftu:textualizer:<VERSION>")
}
将 <VERSION> 替换为你想要使用的库的版本。
用法
你需要在你的项目中实现 Language、LocalizationContext 和 Localization。这意味着你需要处理语言元数据、翻译加载、翻译检索、占位符替换以及语言切换。
参考 Minecraft-specific implementation 以获取如何执行此操作的示例。
给 Minecraft 模组用户
为什么我需要这个?
Minecraft(以及 Forge)的语言管理系统存在许多错误,并且在多个 Minecraft 版本之间表现不一致。本库旨在为你的模组提供一种一致且可靠的翻译管理方式。
它会影响我的 FPS / 性能吗?
不会。该库除了初始加载翻译和语言切换外,不会添加任何影响性能的内容。
给 Minecraft 模组开发者
设置
你需要将其作为依赖项添加到你的 build.gradle(.kts) 文件中。
repositories {
maven("https://maven.deftu.dev/releases")
}
dependencies {
modImplementation("dev.deftu:textualizer-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>")
}
当然,请将 <MINECRAFT VERSION> 替换为你正在开发的 Minecraft 版本,<MOD LOADER> 替换为你正在开发的加载器,并将 <VERSION> 替换为你想要使用的库的版本。
用法
获取当前(游戏中选定的)语言上下文可以这样做:
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
要获取已翻译的字符串,你可以使用
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example");
要获取已翻译的字符串并替换你的占位符,你可以使用
import dev.deftu.textualizer.MCLocalization;
int number = 10;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example", number);
本项目根据 LGPL-3.0 许可证授权。
© 2024 Deftu
Textualizer
A simple localization management library.
Features a Minecraft-specific implementation for mod developers, wrapping around Minecraft's own localization system.
For developers
Setup
You need to add it as a dependency in your build.gradle(.kts) file.
repositories {
maven("https://maven.deftu.dev/releases")
}
dependencies {
modImplementation("dev.deftu:textualizer:<VERSION>")
}
Replace <VERSION> with the version of the library you want to use.
Usage
You'll need to implement Language, LocalizationContext, and Localization in your project. This means you need to handle language metadata, translation loading, translation retrieval, placeholder replacement, and language switching.
Refer to the Minecraft-specific implementation for an example of how to do this.
For Minecraft mod users
Why do I need this?
Minecraft's (and Forge's) language management system is very buggy and inconsistent across several Minecraft versions. This library aims to provide a consistent and reliable way to manage translations in your mods.
Is it going to affect my FPS / performance?
No. The library doesn't add anything which would affect performance outside the initial loading of the translations and language switching.
For Minecraft mod developers
Setup
You need to add it as a dependency in your build.gradle(.kts) file.
repositories {
maven("https://maven.deftu.dev/releases")
}
dependencies {
modImplementation("dev.deftu:textualizer-<MINECRAFT VERSION>-<MOD LOADER>:<VERSION>")
}
Of course, replace <MINECRAFT VERSION> with the version of Minecraft you are developing for, <MOD LOADER> with the mod loader you are developing for, and <VERSION> with the version of the library you want to use.
Usage
Getting the current (selected in-game) language's context can be done like so:
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
To obtain a translated string, you can use
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example");
To obtain a translated string and replace your placeholders, you can use
import dev.deftu.textualizer.MCLocalization;
int number = 10;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example", number);
This project is licensed under LGPL-3.0.
© 2024 Deftu
下载 Textualizer
下载 Textualizer
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Textualizer
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
未提供更新日志。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器


评论 0
登录后参与评分
还没有评论,来抢沙发吧