Skip to content

A spigot plugin to translate plugin messages into different languages

Notifications You must be signed in to change notification settings

ferdithedev/LanguageSupport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LanguageSupport

A spigot plugin to translate plugin messages into different languages. You can translate all plugin messages of plugins which allow editing the messages individually in as many languages as you want.

Important!

  • This plugin isn't using a translation API or something so you have to write each translation in every language manual!
  • This plugin is still under development so it's possible that bugs may occur! Please report them in the issues section.
  • This plugin edits the chat packets a player is receiving using ProtocolLib so it must be installed on the server!

How to use

Setting up

  1. You have to restart your server one time after you loaded the plugin the first time so less bugs can occur!
  2. After that you will see that a few files were created: players.yml, lsconfig.yml, de.yml, en.yml. In the lsconfig.yml file you have to set your chat format if your server software is spigot or less for example:

chat

config

  1. Next you want to set your default language again in lsconfig.yml
  2. As the last step you have to reload all things you changed. The easiest way to do so is using the /lsreload <config/players/languages> command and execute it with each argument one time.

Editing translations

In a subdirectory called languages/ are two files by default. These contain the messages the plugin will need in two languages (de.yml -> german, en.yml -> english).

Without variables

In other plugins config

In the message config of the plugin you want to translate (most times it's called messages.yml) you have to go to the message and edit the message to a placeholder:

grafik

In language files

Now you have to go back in the languages/ subdirectory in the plugin's datafolder and go through every file in there and add a new point with the translation in the file's specific language:

grafik

grafik

With variables

Many messages have variables such as:

2022-04-12_17 35 36

Again you have to use a placeholder but also define the variables:

messages

You can also use more than one variable: ban-notification,vars={operator=%OPERATOR%,name=%NAME%} is an excerpt from a modified AdvancedBans config

Adding languages

Each language has one .yml file with the code of the ISO-3166-1-codelist of the country/language. If it doesn't exist in the list just thing of one yourself. For example the file for english is called en.yml. To register the language you have to add one element to the Languages list in the lsconfig.yml:

Languages:
  - ==: LSLanguage
    name: English
    code: en
    enabled: true
  - ==: LSLanguage
    name: Deutsch
    code: de
    enabled: true

It's important that the code is equal to the file name.

Commands

Command Description
/lslist Lists all languages
/lsreload <config/players/languages> Reloads the specific file(s)
/lang <auto/lang-code> Sets your language (auto sets it to your game language)

About

A spigot plugin to translate plugin messages into different languages

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages