# Get started

{% hint style="info" %}
ColorCodes are always defined with a & character. A list of possible ColorColdes can be found [here](https://htmlcolorcodes.com/minecraft-color-codes/). Please use the CHAT CODE column from the displayed table and replace the § character with the & character.
{% endhint %}

If you have downloaded the LanguageAPI and started the server, a folder named *LanguageAPI* should now have been created in your plugins folder. Now open this folder and edit the `config.yml`.

## Enter license

Add your private license in the `config.yml`. If you don't have one yet, open a support ticket on my discord server.

{% hint style="info" %}
Why do I need a private license? The answer is [here](https://wiki-en.herrtechniker.eu/general/lizenz)
{% endhint %}

## Database

Set the database type in `config.yml`.

### MySQL

Set `database: "mysql"` to store your data in a `MySQL` database. You can access the data across servers. To connect to MySQL database open the file `mysql.yml` and enter your MySQL data.

{% code title="mysql.yml" lineNumbers="true" %}

```yaml
mysql:
  HOST: localhost
  PORT: '3306'
  DATABASE: database
  USER: root
  PASSWORD: password
```

{% endcode %}

### Config

Set `database: "config"` to store your data locally on the server. This data can then only be accessed by this one server. For this purpose the plugin creates a folder named `database` in the plugins folder. In this folder the database file `database.db` will be created.

## BungeeCord?

{% hint style="warning" %}
If you have the LanguageAPI for BungeeCord as well, set the `bungeemode: true`
{% endhint %}

## File system

There are 2 different file systems. These are explained below.

### single

The `single` file system simply means that all messages of all languages are contained in one file. Here is the example from the LanguageAPI:

{% code title="messages.yml" lineNumbers="true" %}

```yaml
english:
  command:
    noConsolCommand: "[LanguageAPI] Please go on the Server and try again!"
    usage: "%prefix% &cPlease use: &e/changelanguage <language>"
    unknowLanguage: "%prefix% &cThe language: &e%language% &cdoes not exists!"
    correctlyUsage: "%prefix% &7Your language was change to &e%language%&7."
    isLanguageAlready: "%prefix% &cYour language is already: &e%language%&c."

deutsch:
  command:
    noConsolCommand: "[LanguageAPI] Bitte gehe auf den Server und versuche es erneut!"
    usage: "%prefix% &cBitte nutze: &e/changelanguage <sprache>"
    unknowLanguage: "%prefix% &cDie Sprache: &e%language% &cexistiert nicht!"
    correctlyUsage: "%prefix% &7Deine Sprache wurde zu &e%language% &7geändert."
    isLanguageAlready: "%prefix% &cDeine Sprache ist bereits: &e%language%&c."
```

{% endcode %}

### multi

In the System `multi` file, each individual language gets its own file. The individual files are in the plugin folder in the `language` folder. This is easy to build: `<language>.yml`

Here is an example:

{% code title="deutsch.yml" lineNumbers="true" %}

```yaml
command:
  noConsolCommand: "[LanguageAPI] Bitte gehe auf den Server und versuche es erneut!"
  usage: "%prefix% &cBitte nutze: &e/changelanguage <sprache>"
  unknowLanguage: "%prefix% &cDie Sprache: &e%language% &cexistiert nicht!"
  correctlyUsage: "%prefix% &7Deine Sprache wurde zu &e%language% &7geändert."
  isLanguageAlready: "%prefix% &cDeine Sprache ist bereits: &e%language%&c."
  
```

{% endcode %}

{% code title="english.yml" lineNumbers="true" %}

```yaml
command:
  noConsolCommand: "[LanguageAPI] Please go on the Server and try again!"
  usage: "%prefix% &cPlease use: &e/changelanguage <language>"
  unknowLanguage: "%prefix% &cThe language: &e%language% &cdoes not exists!"
  correctlyUsage: "%prefix% &7Your language was change to &e%language%&7."
  isLanguageAlready: "%prefix% &cYour language is already: &e%language%&c."
```

{% endcode %}

{% hint style="warning" %}
It is important that the language is also entered in the `config.yml` under the point `supportedLanguages`. Pay attention to the upper and lower case!
{% endhint %}

## Prefix

The prefix is always set before each message from the LanguageAPI. You can change the prefix by changing the line `prefix: "&7[&6LanguageAPI&7]&r"`.

## Change language

As the server owner, you have the option to allow or deny players to change their language. You do this by editing the line `changeLanguage: true`. If you set the setting to `false`, the players will no longer be able to change their language.

{% hint style="info" %}
It would be best if you have the same setting on all servers, i.e. all set to `true` or all set to `false`.
{% endhint %}

## Alias

You can edit the command to change the language. To do this, simply add more entries to the `aliases` setting or remove them. If you only want the default command, simply replace the list with `aliases: []`.

Standardkonfiguration:

{% code lineNumbers="true" %}

```yaml
aliases:
  - "language"
```

{% endcode %}

{% hint style="info" %}
The standard command for changing the language is: `changelanguage`
{% endhint %}

## Default language

The default language is the language that every player automatically receives when they join the server for the first time. To change the default language, simply edit the line\
`defaultLanguage: "english"`.

{% hint style="warning" %}
The default language `must be` listed among the supported languages. You can find the supported languages [here](#supported-languages)
{% endhint %}

## Supported languages

Under Supported languages, you add the languages that your server network should support. You can also remove the supported languages.

{% code lineNumbers="true" %}

```yaml
supportedLanguages:
  - deutsch
  - english
```

{% endcode %}

{% hint style="success" %}
Now you know everything about the settings of the LanguageAPI and you can use it. To implement it in your own plugins, you can go to the API page and see what you can do with it. You can find the page [here](https://wiki-en.herrtechniker.eu/api#languageapi).
{% endhint %}

## Default configuration

{% code title="config.yml" lineNumbers="true" %}

```yaml
# The standard license is only valid for 7 days. Please request your private license on my Discord (link: https://discord.herrtechniker.eu).
# You have to present your bill to prove that you bought the LanguageAPI.
license: ""

# Insert "mysql" to use mysql (cross-server access) or insert "config" to use local database (only local servers have access)
database: "mysql"

# If you use the LanguageAPI for Bungeecord, please set 'bungeemode = true'
# ATTENTION Pleasemake sure your database type is mysql! If not, an error will occur and the plugin will not start!
bungeemode: false

# If this option set 'single' the different languages are in one file
# and will be listed like the following example:
# english:
#   path1:
#     path1.1: x
#     path1.2: xy
#   path2: 4
# deutsch:
#   path1:
#     path1.1: x
#     path1.2: xy
#   path2: 4
# etc...
#
# If this option set 'multi' then every language has an own file
# like for english: "english.yml"
# or for deutsch "deutsch.yml" (german)
#
# !!!!ATTENTION!!!!
# - the language path for the structure single has been the same name and spelling like in the list supportedLanguages
# - the language file name for structure multi has been the same name and spelling like in the list supportedLanguages
# - After changing the language structure, the file(s) will be deleted. Before that, make a backup to transfer the messages to the other structure.
languageStructure: "single"

prefix: "&7[&6LanguageAPI&7]&r"

# enable the command to change your language
changeLanguage: true

# aliases for the language command
aliases:
  - "language"

# has also been listed in supportedLanguages
defaultLanguage: "english"

# List of all supported Languages
supportedLanguages:
  - deutsch
  - english
```

{% endcode %}

## Command

### Syntax

```
/changelanguage <Sprache>
```
