90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!
Textualizer
An extension upon Textile which has it’s own custom I18n implementation.
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
To create a translated string, you can use
import dev.deftu.textualizer.LanguageManager;
String text = LanguageManager.translate("com.example");
To create a translated string with arguments, you can use
import dev.deftu.textualizer.LanguageManager;
int number = 10;
String text = LanguageManager.translate("com.example", number);
Interopability with Textile
Textualizer provides implementations of TextHolder
and MutableTextHolder
(or, more specifically, SimpleTextHolder
and SimpleMutableTextHolder
)
import dev.deftu.textile.TextHolder;
import dev.deftu.textile.MutableTextHolder;
import dev.deftu.textualizer.text.TextualizerTextHolder;
import dev.deftu.textualizer.text.TextualizerMutableTextHolder;
TextHolder text = new TextualizerTextHolder("com.example");
MutableTextHolder mutableText = new TextualizerMutableTextHolder("com.example");
This project is licensed under LGPL-3.0.
© 2024 Deftu
Links
Details
Licensed LGPL-3.0-or-later
Published 6 months ago
Updated 5 months ago