This is not a plugin, it is for developers only, do not install it on your server. However, information is available below for server owners that use plugins that utilise Languagy.
Languagy is a Spigot API to make it easy for plugins to support player-individual languages.
Translations are retrieved from your plugin based on the player's selected language in their client settings. All Minecraft client languages are
supported.
Note: Languagy is
not intended to automatically translate - you are expected to provide translations yourself via files. Languagy is just a helpful wrapper to handle all that.
How it works, internally.
Why? Supporting multiple languages is rare in servers these days. When it does happen, this is done through obscure GUIs. Languagy makes this simple by automating the process to have no impact on your users, improving the quality of your server. It is simple to use and can be integrated into plugins easily and cleanly, including via gradle/maven shading.
Supported plugins Want your plugin here? PM me, post in the discussion, or leave a review.
Maven:
Please also exclude & relocate on maven - I don't have an example here as I do not use Maven, so please find that for yourself. The gradle config shows what you need to exclude & relocate from/to.
API Usage - updated for v3 Once you have added Languagy as a dependency as described in the above section, you will need to do a few things to get it to work.
In your plugins onEnable, you'll want to initialise a new Translator;
Code (Java):
private Translator translator
;
public Translator getTranslator
(){ return translator
; }
@Override
publicvoid onDisable
(){ translator.
close();// IMPORTANT! See below. }
There are several ways to initialise the translator, please
see the JavaDocs for information on this.
Important: In your onDisable method, you should always call Translator#close. This ensures the file watch system is closed down properly. Expect problems if you do not do this!
You can now use language-specific features and get translations via Translator#getTranslationFor.
To colour translations, you will want to use Translation#colour, or you can simply use the Translation#send method which will handle this all for you and use Player#sendMessage.
If you do not have a translated language file for the player's target locale, then it will fall back to the default provided, which will by default be English.
Bug Reporting/Support/Questions Issues should be filed by hitting the issues tab in gitlab. Please make sure you search your issue before opening a new ticket.
All opened tickets that are bug reports require a debug log that includes logs of the issue in question.
FAQ:
Do I need to restart/reload to update messages? No, the file is kept updated so you never need to restart/reload, you can change it whilst the server is running and see the changes take effect instantly.
Performance? I have ran Languagy on servers with 70+ players and also smaller servers, and the impact is extremely minimal. Languagy also works asynchronously where possible.
Compiling Languagy builds on Java JDK 1.8 and uses Gradle to manage dependencies.