Languages & Messages

2commands
3files
1figure
1min read
Sheet 46 of 53 · Server Admin

Fileslang/en.yml · config.yml · lang/de.yml

Filelang/en.ymlFileconfig.ymlCommand/is languageCommand/is admin reloadEvery line IgniteSky sends - chat, menus, titles, the boss bar - comes from a language file in lang/, so you can translate or reword all of it without touching code. Players can pick their own language, and IgniteSky can adopt their client locale automatically.

How it works

Filelang/en.ymllang/<code>.yml holds every message keyed by id. lang/en.yml ships by default. The text is MiniMessage, so colours, gradients and hover/click all work, and messages take <placeholder> tags (like <player> or <language>) that IgniteSky fills in.

config.yml
messages:
  default-language: en          # lang/<code>.yml used for players without a chosen or detected one
  languages:                    # the codes players may choose with /is language
    - en
  auto-detect-language: true    # adopt a player's client locale on first join if it is installed
  notice-cooldown-ms: 2000      # min gap between repeated action-bar notices (protection denials, locked chunks)
  number-format: "#,##0.##"     # Java DecimalFormat pattern for worth/level/bank placeholders
  date-format: "yyyy-MM-dd HH:mm" # DateTimeFormatter pattern for date placeholders

Choosing a language

Every language the server ships, picked per player.
The language picker with English hovered and marked selected
CommandWhat it does
/is languageOpen the language picker (aliases `lang`, `locale`)
/is language <code>Switch to a specific language

A player's choice is saved in their personal preferences and used for everything they see. With auto-detect-language on, a player who has never chosen one gets their Minecraft client language on first join - provided that code is installed and listed - otherwise they fall back to default-language.

Adding a translation

  1. Copy the default

    Filelang/en.ymlFilelang/de.ymlCopy lang/en.yml to lang/<code>.yml (for example lang/de.yml) in the plugin's data folder.

  2. Translate the values

    Translate each message value. Keep the <placeholder> tags and MiniMessage formatting intact; only change the words.

  3. Set its display name

    Config keylanguage.displayCommand/is languageSet the language.display key inside the new file - that is the name shown in the /is language picker.

  4. List the code

    Config keymessages.languagesFileconfig.ymlCommand/is admin reloadAdd the code to messages.languages in config.yml, then /is admin reload.

Number and date formatting

Worth, level and bank placeholders run through number-format (a Java DecimalFormat pattern, e.g. #,##0.##), and date placeholders through date-format (a DateTimeFormatter pattern). Grouping and decimal symbols follow the default-language locale, so a European locale shows 1.234,5 where en shows 1,234.5.

Loading the index

Enter openUp Down moveEsc close