International Languages

QLD Minecraft supports international languages through the use of translation files in YAML format.

Adding additional languages

Each module of QLD Minecraft references text from language files using YAML keys. Below is a basic example of the layout of a language file:

language:
basic_example:
en:
hello_text: Hello everybody
fr:
hello_text: Bonjour tous le monde
de:
hello_text: Hallo zusammen

The text that a module will narrate is determined on what language setting the player is currently set to.

  • The default player language is en

  • Players can change this setting using the /language <code> command

  • If an entry is not available for the current language setting of the player, QLD Minecraft will default to en

To add additional languages, simply add a new entry within the language file itself.

Colour

Availability: 270+

Retrieve a colour code assigned to a variable. If the variable does not exist, the procedure will return &f.

There are several colour types available for modules by default:

Variable Name

Default Colour

Typical Usage

SERVER

§e

Server notifications and narration

VALUE

§f

Narration of values

DEBUG

§3

Narration of debug information

ERROR

§4

Server error narration

CHAT-PLAYER

§f

Player chat

CHAT-MODERATOR

§2

Moderator chat

CHAT-DEVELOPER

§5

Developer chat

You can include colour variables within your language text by using the following code $COLOUR-<VARIABLE>$.

For example, if I would to narrate a server response that contains a players name, and I would like the text to use the SERVER variable colour and the players name to be in the VALUE variable colour, I would format the text as:

$COLOUR-SERVER$Welcome $COLOR-VALUE$nomadjimbob $COLOUR-SERVER$to the minecraft server!

Minecraft
Denizen
Minecraft

There is no minecraft command for this information

Denizen
# Retrieve a colour variable value
<proc[qmp_i18n.get.colour].context[<variable>]>
# Check if a colour variable exists
<proc[qmp_i18n.exists.colour].context[<variable>]>

Placeholder

Availability: 270+

Retrieve placeholder text assigned to a variable. If the variable does not exist, the procedure will return <empty>.

There are several placeholders available for modules by default:

Variable Name

Default Text

Typical Usage

PREFIX-SERVER

[SERVER]:

Important server notifications

PREFIX-DEBUG

[DEBUG]:

Debug notifications

NOTSET

(not set)

Value is not set

CREATIVE

Creative

SURVIVAL

Survival

PVP

PVP

You can include placeholder variables within your language text by using the following code $<VARIABLE>$.

For example, if I would to narrate a server response that contains the PREFIX-SERVER variable I would format the text as:

$PREFIX-SERVER$Welcome to the minecraft server!

Minecraft
Denizen
Minecraft

There is no minecraft command for this information

Denizen
# Retrieve a placeholder variable value
<proc[qmp_i18n.get.placeholder].context[<variable>]>
# Check if a placeholder variable exists
<proc[qmp_i18n.exists.placeholder].context[<variable>]>

Language

Availability: 270+

Retrieve or set the language code for a player

Minecraft
Denizen
Minecraft

Retrieves or sets the language for a player

/qm language [player] [language]

Value

Required

Details

player

Optional

Players name to retrieve the language setting. If no player name is entered, the current player is used.

The use of a player name value requires Moderator permission

language

Optional

The language code to use for the player based on the player value.

If this value is not present, the command will return the current value for that player.

Examples

Retrieve the current language being applied to the current player:/qm language

Retrieve the current language being applied to a player named nomadjimbob (requires Moderator permission): /qm language nomadjimbob

Set the language to German for the current player: /qm language de

Set the language to German for the player named nomadjimbob (requires Moderator permission): /qm language nomadjimbob de

Denizen
# Retrieve the current languge code for a player
<proc[qmp_i18n.get.language].context[<player>]>
# Set the language code for a player
qm_i18n.set.language def:<player>|<language_code>

Add Internationalization

Availability: 270+

Modules can add their own internationalization either through a seperate YML file or a data script container. The data supplied is then merged into /serverdata/language.yml to allow user editing, without modifying the code file itself.

The format of the YML file or script container is required to be:

colour:
<variable>: <colour_letter>
<variable_2>: <colour_letter>
placeholder:
<variable>: <text>
<variable_2>: <text>
language:
<module_name>:
<language_code>:
<variable>: <text>
<variable_2>: <text>
<variable_3>: <text>
<language_code>:
<variable>: <text>
<variable_2>: <text>
<variable_3>: <text>
  • Only the YML keys colour, placeholder and language are used.

  • Colour variables are checked that they are a single character and a valid colour.

  • Colour, Placeholder, or module_name variables that already exist in the /serverdata/langauge.yml file are ignored

Minecraft
Denizen
Minecraft

There is no minecraft command for this information

Denizen
# Add a language file
qm_i18n.add.file def:<path>
# Add a language data script container
qm_i18n.add.container def:<name>

Translation

Available: 270+

Retrieve a internationalization string and parse any colours, placeholders and mappings.

Your internationalization string can contain placeholder mappings that can be filled at runtime by using the format $MAPPING_NAME$ and instead passing a map object instead of a list object. The first pair of the map is required to be the <module_name>/<variable> with any additional pairs being the mapping key/value

Minecraft
Denizen
Minecraft

Denizen
# Retrieve a internationalization string
<proc[qmp_i18n].context[<module_name>|<variable>]>
# Retrieve a internationalization string with a mapping replacing PLAYER with the players name
<proc[qmp_i18n].context[<map[<module_name>/<variable>|player/<player.name>]>]>