MultiLanguagePlugin - Configuration

Sep 20, 2017 at 4:24 PM
MultiLanguagePlugin - Configuration
  • MultiLanguagePlugin - Configuration EN

    Sends the same message on different languages... Hooks into all plugins!




    Introduction(top)

    Welcome to the MultiLanguagePlugin tutorial. If you didn't buy the plugin yet, we recommend doing, as you'll need it for this tutorial.

    Installing MLP(top)

    It's simple to install MLP! Just follow the steps below and you'll install it in less than a minute!
    1. Download the latest MLP version
    2. Drop it onto your plugin folder
    You're done! See? It's not so hard.

    Adding and removing languages(top)


    To process of adding and removing languages is really simple. First of all, open your config.yml. Then scroll down to the languages section. If you didn't change it already, it should contain English and Portuguese (Portugal).

    This is the structure of a language:

    Code (YAML):
    <any name>:
        flag
    : <flag to display on the GUI selector>
        minecraft-code
    : <the language code>
        display-name
    : <the display name in game (supports colors)>
    • The name of the section (<any name>) can me literally anything, it just need to be unique.
    • flag - This is a difficult one, but I explain it in the other page of the documentation. Take a look here.
    • minecraft-code - Is is fairly simple. You just need to pick the language code that matches your language. Full list here. This is used to detect the player's language, although it has some problems right now, as the client takes up to 5 seconds to send that information to the server.
    • display-name - I think the name says all. This will be used on the GUI and on chat. Supports colors.

    Hooking into other plugins(top)

    Congratulations, you reached the configuration steps!
    Now that you're here, I'll teach you how to configure MLP correctly.

    First of all, if you don't have a folder called MultiLanguagePlugin on your plugins folder, you should start and stop your server, just to generate it.

    Now you have the MLP folder, open the languages folder inside. You'll have two files: en_GB.language and pt_PT.language. These will contain all the messages for your server, so remember to keep them safe!
    Open the en_GB.language file and let's start writing some simple sentences. I'll use EssentialsX as "the other" plugin and we'll make it multi-language.

    To get the essentials language file, you can either use WinRar (or another similar program) to open the jar to get the messages_en.properties or you can just go to their GitHub page and copy the file contents.

    In this tutorial, we'll make two of the messages multi-language: one with simple placeholders and another with advanced ones.

    Simple Placeholders(top)

    Add the message you want to translate to your languages files (en_GB.language and pt_PT.language). I'll translate the "heal" message, so I'll start by copying it from the EssentialsX properties file.

    en_GB.language
    Code (Text):
    essentials.heal = &6You have been healed.
    pt_PT.language
    Code (Text):
    essentials.heal = &6Foste curado.

    If you go in-game now, nothing will happen... why?
    You didn't add the placeholder to Essentials, so MLP won't replace that message. To have it, just replace the default message with the placeholder (What are MLP placeholders?):
    Code (Text):
    ...
    heal=[lang]essentials.heal[/lang]
    ...
    Now if you go in-game, you'll see that if you change your language to Portuguese, it will appear the Portuguese translation instead of the English one.

    Congratulations, you finished the Simple Placeholders tutorial!

    Advanced Placeholders(top)

    Advanced placeholders give you access for more complex translations. They allow variables (such as player names, texts, numbers, etc) on messages, so you can create advanced messages, like death messages.

    First, find the message you want to translate. I'll use another EssentialsX message, this time, the "healOthers" message. As you can see, there is a {0} in the message, which means that will be replaced by something, in this case, a player name.

    Essentials file:
    Code (Text):
    ...
    healOthers = [lang]essentials.healOthers[args][arg]{0}[/arg][/args][/lang]
    ...
    en_GB.language
    Code (Text):
    ...
    essentials.healOthers = &6Healed&c %1&6.
    ...

    ActionBars, Titles, Subtitles, Scoreboards and Holograms(top)

    How do they work? Just like normal text!

    If you put placeholders inside them, they will also work (with proper configuration)!
    Also, don't forget that you can use it on NPCs too!

    GUIs(top)

    Currently, only GUIs title are supported, and they work just like the other things. Stay tuned for the items update!

    Frequent Errors(top)

    • I have a lot of spam on my console and this is one of the lines: Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line X column X
      • Check your code; you have malformed JSON somewhere. Valid JSON must include quotes around the keys and values, like {"text":"This is a text"}.
    • I got kicked with the following message: Internal Exception: io.netty.handler.codec.DecoderException: The received string length is longer than maximum allowed (XX > 32)
      • You have exceeded the maximum characters on the scoreboard. If you didn't, you probably are missing some message on your .language file. If you are lost, disable the scoreboard translations on config and check which messages are missing.
  • Loading...
  • Loading...