Home›Java›Mods›[1.7.x-1.12]Language Utils
ModsJava

[1.7.x-1.12]Language Utils

Java mod listed for Minecraft 1.7–1.12. Download on the author's site.

⬇ Download on Spigot
Introduction
It was always a problem to get the localized name of an item(afaik), so Language Utils came out to solve this issue. This API only provides names for vanilla strings.

In the following updates, I also add the support for entities, enchantments, and enchantment levels.

The major version is for Spigot/Bukkit 1.12. If you are using Spigot/Bukkit 1.7.10, 1.8.9, 1.9.4, 1.10.x, or 1.11.x, use this, this, this, this, or this instead.

Update: You can use the latest 1.7.10 version of this API on Cauldron/KCauldron servers now. You can download the latest 1.7.10 version here. Again, the API only supports vanilla items/entities(Though it will return the material name if the item is not vanilla).

Status: [​IMG]

Resources

Installation
If you are a server owner, just drop the plugin into your plugins/ folder. This plugin itself does not have any functions and it may take 100-250 ms to load all the language files. If you want to customize the language entries, please read the README.txt inside plugins/LangUtils/lang/.

If you are a developer, add the API to your build path. Additionally, if you are using Gradle or Maven:

Gradle: add the following to your build.gradle
Code (Text):
repositories {
    maven {
        url 'https://raw.github.com/MascusJeoraly/LanguageUtils/mvn-repo/'
    }
}
dependencies {
    compile group: 'com.meowj', name: 'LangUtils', version: '1.9' // Please check the latest version
}
Maven: add the following to your pom.xml
HTML:
<repositories>
  <repository>
    <id>lang-utils-repo </id>
    <url>https://raw.github.com/MascusJeoraly/LanguageUtils/mvn-repo/ </url>
  </repository>
</repository>

<dependencies>
  <dependency>
    <groupId>com.meowj </groupId>
    <artifactId>LangUtils </artifactId>
    <!--Please check the latest version -->
    <version>1.9 </version>
  </dependency>
</dependencies>
Usage
Spoiler: Items
1. Get the display name of an item(including customized name):
Code (Text):
LanguageHelper.getItemDisplayName(itemStack, locale);
LanguageHelper.getItemDisplayName(itemStack, player);
For example, if you want to get the English name of an item:
Code (Text):
LanguageHelper.getItemDisplayName(itemStack, "en_us");
2. Get the localized name of an item:
Code (Text):
LanguageHelper.getItemName(itemStack, locale);
LanguageHelper.getItemName(itemStack, player);
3. Get the unlocalized name of an item
Code (Text):
LanguageHelper.getItemUnlocalizedName(itemStack);
Spoiler: Entities
1. Get the unlocalized name of an entity
Code (Text):
LanguageHelper.getEntityUnlocalizedName(entity);
LanguageHelper.getEntityUnlocalizedName(entityType);
2. Get the localized name of an entity
Code (Text):
LanguageHelper.getEntityName(entity, locale);
LanguageHelper.getEntityName(entity, player);
LanguageHelper.getEntityName(entityType, locale);
LanguageHelper.getEntityName(entityType, player);
3. Get the display name of an entity(including customized name)
Code (Text):
LanguageHelper.getEntityDisplayName(entity, locale);
LanguageHelper.getEntityDisplayName(entity, player);
Ofc, if you only want the English name of an entity, you can just use
Code (Text):
entity.getName();
Spoiler: Enchantments
1. Get the unlocalized name of an enchantment
Code (Text):
LanguageHelper.getEnchantmentUnlocalizedName(enchantment);
2. Get the name of an enchantment
Code (Text):
LanguageHelper.getEnchantmentName(enchantment, player);
LanguageHelper.getEnchantmentName(enchantment, locale);
3. Get the full name of an enchantment(including its level)
Code (Text):
LanguageHelper.getEnchantmentDisplayName(enchantment, level, player);
LanguageHelper.getEnchantmentDisplayName(enchantment, level, locale);
LanguageHelper.getEnchantmentDisplayName(entry, level, player);
LanguageHelper.getEnchantmentDisplayName(entry, level, locale);
where entry is Map.Entry<Enchantment, Integer>.
Spoiler: Enchantment levels
1. Get the unlocalized name of an enchantment level
Code (Text):
LanguageHelper.getEnchantmentLevelUnlocalizedName(level);
2. Get the name of an enchantment level
Code (Text):
LanguageHelper.getEnchantmentLevelName(level, player);
LanguageHelper.getEnchantmentLevelName(level, locale);
Spoiler: Misc
1. Translate an unlocalized name
Code (Text):
LanguageHelper.translateToLocal(unlocalizedName, locale);
2. Get the language a player is using
Code (Text):
LocaleHelper.getPlayerLanguage(player);

3. Add/Replace a language entry
Code (Text):
LanguageRegistry.INSTANCE.registerEntry(lang, unlocalizedName, localizedName);

You can see this demo plugin for more details.

Build
This API uses Gradle to manage the source code. If you want to build the project your self, simply run
Code (Text):
gradle build
or
Code (Text):
gradlew build
if you don't have Gradle installed.

Configuration

Code (Text):

# When a name in the language requested does not exist, the name will be retrieved in this language. The default fall back language is English.
FallbackLanguage=en_us
# If you want to enable the loading of a language, add it to the following list
LoadLanguage= [en_us, zh_cn, zh_tw]
# Or
LoadLanguage:
- en_us
- zh_cn
- zh_tw
# If you want to load all the languages, add "all" to the list:
LoadLanguage:
- all
 

Known Issues

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

[1.7.x-1.12]Language Utils is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 9,051 times (via Spigot). Download it and open it directly in the game.

Explore more