HomeJavaMods[API] Languages
[API] Languages
[​IMG]


[SPONGE VERSION]

Languages is a simple API who allows to use diferents languages in a server.

Spanish review by Maximiliano

[​IMG]

Spoiler: Setup
To use Languages you only must add it into your plugins folder and restart your server. You need also a plugin who use it.

If you want to add your own languages files to a plugin, only copy its default language file and start translating!

[​IMG]

Spoiler: Commands
  • /setLang [LANG] - Sets a player language. If arg. lang is empty, Languages will get his language from Minecraft.
  • /langReload - Reloads all languages from all plugins!
  • /langPlugins- Shows a full list of plugins who supports Languages, and its languages.

[​IMG]

Spoiler: Permissions
  • languages.langreload - Allows to use /langReload
  • languages.langplugins- Allows to use /langPlugins

[​IMG]

Spoiler: Configuration
The configuration of Languages is pretty simple!

  • DataBase - In there you can add a MySQL or SQLite database. If you need help please check this web: http://wiki.bukkit.org/Bukkit.yml#database
  • DefLang - You can select the default language in your server with this node.
  • getMinecraftLang - If true, Languages will get all languages from Minecraft; if not, it will use the default language on the config file.
Code (Text):
database:
  driver: org.sqlite.JDBC
  url: jdbc:sqlite:{DIR}{NAME}.db
  username: bukkit
  password: walrus
  isolation: SERIALIZABLE
  logging: true
DefLang: en_US
firstJoin:
  getMinecraftLang: true

[​IMG]

Spoiler: Bukkit / Spigot
This is a guide who explains who works Languages and how you can work with it.

- Step 1:

In your plugin resources, create a yml with the name "en_US.yml". en_US is the default language of Languages. You can also create more YAML files, like "es_ES.yml". Languages will detect them!

[​IMG]

- Step 2:


In each language YAML, add the node "prefix". This node will be the prefix of your plugin!
[​IMG]

- Step 3:


Go to your class Main, and in the first line of the method onEnable(), write this:
Code (Text):
LanguageUtils.loadPlugin(this);

Now create a listener class and write this:
Code (Text):
@EventHandler
public void langs(LangsLoadEvent e) {
    e.addPlugin(YOUR PLUGIN INSTANCE);
}

- Step 4:

Use the class SendManager to send or get messages!

- Extra:

  • If you want to add messages to your plugin, only write them in your YAMLs! Languages will add them automatically.
  • You can get the default language at Languages.getDefaultLanguage();
Spoiler: Sponge
[Example]

- Step 1:

In your plugin resources, create a folder with this name:

Code (Text):
<PLUGIN ID>_languages
There we will add all language files.

Now create a yml with the name "en_US.yml". en_US is the default language of Languages. You can also create more YAML files, like "es_ES.yml". Languages will detect them!

[​IMG]

- Step 2:


In each language YAML, add the node "prefix". This node will be the prefix of your plugin!
[​IMG]

- Step 3:

Go to your main class and add "languages" as a dependency.

[​IMG]

After this, add this line to your enable listener:

[​IMG]

And create this listener:

[​IMG]


Ready!

Now you can use the Class SendManager to send messages to your players or get them!

[​IMG]



If you have any issue or question, please send me a PM and don't write it in a review! I'll ignore it. [/SPOILER]

Commands

Plugin details

Read from the plugin's own plugin.yml.

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.

[API] Languages is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10. Downloaded 11,356 times (via Spigot). Download it and open it directly in the game.

Explore more