Textualizer
A localization management library with a ready-made implementation for Minecraft that works on top of the game's standard translation system.
For mod developers
Project setup
Add the dependency to your project's build.gradle(.kts) file:
repositories {
maven("https://maven.deftu.dev/releases")
}
dependencies {
modImplementation("dev.deftu:textualizer-<MINECRAFT VERSION>-<MOD LOADER>:<LIBRARY VERSION>")
}
Replace <MINECRAFT VERSION> with the required game version, <MOD LOADER> with the mod loader used, and <LIBRARY VERSION> with the current library version.
Code usage
Getting the current language context:
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
Getting a translated string:
import dev.deftu.textualizer.minecraft.MCLocalization;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example");
Translation with value substitution:
import dev.deftu.textualizer.minecraft.MCLocalization;
int number = 10;
LocalizationContext context = MCLocalization.current();
String text = context.get("com.example", number);
For mod users
Why is this needed?
Minecraft's standard localization system works unstably and differs across game versions. Textualizer provides consistent and reliable translation functionality across all mods.
Performance impact
The library does not negatively affect FPS and game performance, except for the initial loading of translations and language switching.
License
The project is distributed under the LGPL-3.0 license. © 2024 Deftu