This is a small internationalization (i18n) library tailored for Minecraft plugins, particularly those built on the Paper platform. It simplifies translation management, allowing you to easily support multiple languages for better player experience.
Important
This library is designed to work with a Paper server and is intended for plugin developers only! It is not meant to be used directly by server owners or players.
The goal of this project is to provide an easy-to-use API that helps Minecraft plugin developers add localization support to their plugins.
There are two main components in this project:
api
: Contains the API classes for managing translations and interfacing with localization files.example
: An example implementation demonstrating how to integrate and use the i18n library in a plugin.
- Simple API for loading and retrieving translations
- Customizable language files, supporting different locales
- Optimized for Minecraft plugins with a focus on ease of use
To include this library in your own plugin project, you can pull it from the Reposilite repository. Below are instructions for different build tools:
-
Add the Reposilite Repository:
repositories { maven { url = uri("https://repo.ole101.de/releases") } }
-
Add the Dependency:
dependencies { implementation("de.ole101:i18n:VERSION") }
-
Optional: Relocate with Shadow Plugin:
plugins { id("com.github.johnrengelman.shadow") version "8.1.1" } tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") { relocate("de.ole101.i18n", "your.plugin.package.libs.i18n") }
-
Add the Reposilite Repository:
repositories { maven { url "https://repo.ole101.de/releases" } }
-
Add the Dependency:
dependencies { implementation 'de.ole101:i18n:VERSION' }
-
Optional: Relocate with Shadow Plugin:
plugins { id 'com.github.johnrengelman.shadow' version '8.1.1' } shadowJar { relocate 'de.ole101.i18n', 'your.plugin.package.libs.i18n' }
-
Add the Reposilite Repository:
<repositories> <repository> <id>ole101-releases</id> <url>https://repo.ole101.de/releases</url> </repository> </repositories>
-
Add the Dependency:
<dependencies> <dependency> <groupId>de.ole101</groupId> <artifactId>i18n</artifactId> <version>VERSION</version> </dependency> </dependencies>
-
Optional: Relocate with Maven Shade Plugin:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <relocations> <relocation> <pattern>de.ole101.i18n</pattern> <shadedPattern>your.plugin.package.libs.i18n</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin> </plugins> </build>
To use this library in your Minecraft plugin:
-
Load translations: Create language files (e.g.,
common_en.properties
,common_de.properties
) and place them in your resources folder. -
Retrieve messages: Use the provided API methods to retrieve messages in a specific language. The API can fetch translations based on a player’s locale.
-
Example Plugin: Refer to the
example
module for a complete implementation on how to set up i18n in a Minecraft plugin.
Feel free to contribute by forking this repository, creating a new branch, and submitting a pull request. Contributions for optimizations and features are always welcome!