main/Instructions (english)
How to connect your plugin with Lingvo?
There are some ways of do it, it depends on whether you want to leave Lingvo manage all the work or you want to use your own code.
Adding the library
First, you must to add Lingvo.jar as a library for your plugin, like you did with Bukkit.jar.
You must to store the Translator object (com.github.coegho.lingvo.api.ITranslator) on any place of your plugin. A good system is to store it in the main class (the class that extends from JavaPlugin). Declare an variable with the ITranslator interface with the next code:
private ITranslator translator;
Add a method to get it:
public ITranslator getTranslator() {
return translator;
}
Any time you need to send a message to an user, you must to use the next code to get the translation:
plugin.getTranslator().translate(userName, messageKey);
Where plugin is your plugin, userName the name of the user that receive the message, and messageKey the key that get the right message from inside of the linguage file.
Secondly, you must to decide between doing your plugin Lingvo dependent (easy way) or independent (more diffficult way).
Lingvo dependent
Modify plugin.yml and add the next line:
depend: [Lingvo]
Comments