# 🌍 Languages & Translations

## Translations

Every line the plugin can print lives in one file:

```
PhoenixCrates/translations/translations.en.yml
```

Messages to players, command replies, the holograms, the menus and the whole in-game editor are all in there. Edit it, run /crates reload, and the new text is live.

To stop a message from appearing at all, set it to `''` (empty quotes).

Every add-on brings its own file into the same folder, named after itself, so the Rarity messages are in `rarity.translations.en.yml` and the Lootbox ones in `lootbox.translations.en.yml`. They work exactly like the main file.

> **Info:**
Older versions kept this in **messages.yml**. On the first start after upgrading, the plugin copies your text across into the translation file on its own and renames the old one to **old_messages.yml**. Editor text is not carried over, since the old file never had it.

## Language

The language the plugin loads is set in config.yml, or from **Editor > Settings > Language**.

```yaml
language: UNDEFINED
```

<figure><img src="../.gitbook/assets/editor/language.png" alt="" width="375"><figcaption><p>Editor > Settings</p></figcaption></figure>

UNDEFINED is the value a fresh install starts on, and it behaves as English. It is also the one value the editor will not let you pick again once you have chosen a real language.

The picker lists every language the plugin knows about:

<table><thead><tr><th width="110">Code</th><th width="240">Language</th><th>File</th></tr></thead><tbody><tr><td><code>EN_US</code></td><td>English (United States)</td><td><code>translations.en.yml</code></td></tr><tr><td><code>AR_SA</code></td><td>Arabic (Saudi Arabia)</td><td><code>translations.ar.yml</code></td></tr><tr><td><code>PT_BR</code></td><td>Portuguese (Brazil)</td><td><code>translations.br.yml</code></td></tr><tr><td><code>PT_PT</code></td><td>Portuguese (Portugal)</td><td><code>translations.pt.yml</code></td></tr><tr><td><code>ES_ES</code></td><td>Spanish (Spain)</td><td><code>translations.es.yml</code></td></tr><tr><td><code>FR_FR</code></td><td>French (France)</td><td><code>translations.fr.yml</code></td></tr><tr><td><code>DE_DE</code></td><td>German (Germany)</td><td><code>translations.de.yml</code></td></tr><tr><td><code>IT_IT</code></td><td>Italian (Italy)</td><td><code>translations.it.yml</code></td></tr><tr><td><code>NL_NL</code></td><td>Dutch (Netherlands)</td><td><code>translations.nl.yml</code></td></tr><tr><td><code>SV_SE</code></td><td>Swedish (Sweden)</td><td><code>translations.sv.yml</code></td></tr><tr><td><code>PL_PL</code></td><td>Polish (Poland)</td><td><code>translations.pl.yml</code></td></tr><tr><td><code>CS_CZ</code></td><td>Czech (Czechia)</td><td><code>translations.cs.yml</code></td></tr><tr><td><code>RU_RU</code></td><td>Russian (Russia)</td><td><code>translations.ru.yml</code></td></tr><tr><td><code>TR_TR</code></td><td>Turkish (Turkey)</td><td><code>translations.tr.yml</code></td></tr><tr><td><code>EL_GR</code></td><td>Greek (Greece)</td><td><code>translations.el.yml</code></td></tr><tr><td><code>HI_IN</code></td><td>Hindi (India)</td><td><code>translations.hi.yml</code></td></tr><tr><td><code>ID_ID</code></td><td>Indonesian (Indonesia)</td><td><code>translations.id.yml</code></td></tr><tr><td><code>VI_VN</code></td><td>Vietnamese (Vietnam)</td><td><code>translations.vi.yml</code></td></tr><tr><td><code>JA_JP</code></td><td>Japanese (Japan)</td><td><code>translations.ja.yml</code></td></tr><tr><td><code>KO_KR</code></td><td>Korean (South Korea)</td><td><code>translations.ko.yml</code></td></tr><tr><td><code>ZH_CN</code></td><td>Chinese (Simplified)</td><td><code>translations.zh.yml</code></td></tr></tbody></table>

The file name uses the short form rather than the code, which is worth knowing before you go looking for it — PT_BR writes `translations.br.yml`, not `translations.pt_br.yml`.

> **Warning:**
Only the languages included in the build you are running can be picked. The rest are dark grey in the editor and clicking skips straight past them. At the moment the plugin ships with English, so the way to run it in another language is to translate the file yourself.

## Setting it from a command

/crates setLanguage \<language> switches language without a full reload. It only accepts a language the build actually ships, and answers `No translation is bundled for language ...` for anything else.

While `language` is still UNDEFINED, anyone joining with phoenixcrates.admin is offered a suggestion in chat, picked from where the server appears to be, with the command ready to click. Setting a language yourself stops it.

## Translating the plugin

Everything sits under the short language code at the top of the file, and the value is either a line or a list of lines. Translate the right-hand side and leave the keys and the placeholders alone.

```yaml
en:
  unknown-argument: "&cUnknown Argument!"
  no-permission: "&cYou are not allowed to do this! (Need %permission%)"
```

```yaml
en:
  error-processing:
    - "&cAn error occurred while processing this action (Check console):"
    - "&7%message%"
```

Anything wrapped in `%` is filled in by the plugin, so `%player%`, `%permission%` and `%message%` have to survive the translation to keep working. Colour codes can be moved around freely.

> **Info:**
English is always loaded first, and the chosen language is laid over the top of it. A key you have not translated yet falls back to its English line rather than printing blank, so a file can be translated a piece at a time.

> **Info:**
Keep a copy of your translated file before updating the plugin. New keys are added to it automatically — the console prints `Missing value for key "..."` and writes the English default straight into your file — but it is the file your work lives in.

## The editor is translated too

Everything under the `editor` keys is the text of the in-game editor — the name and description of every option. Translating those is optional, and skipping them leaves the editor in English while your players see your language.

## Rich Text (MiniMessage)

Phoenix Crates understands [MiniMessage](https://docs.advntr.dev/minimessage/format.html) tags, like `<red>`, `<bold>` or `<gradient:#ff5555:#5555ff>`, on top of the classic `&` colour codes. This lets you use gradients, hover text and clickable links, none of which `&` codes can do.

### Format

| Example                                                  | Result                                 |
| -------------------------------------------------------- | -------------------------------------- |
| `<red>Hello`                                             | Red text                               |
| `<#ff8800>Hello`                                         | Any hex colour                         |
| `<gradient:#5e4fa2:#f79459>Phoenix Crates</gradient>`    | Text fading from one colour to another |
| `<bold><underlined>Warning`                              | Bold and underlined                    |
| `<rainbow>Legendary!</rainbow>`                          | Each letter a different colour         |
| `<hover:show_text:'Click me'>Hover</hover>`              | Text with a tooltip                    |
| `<click:open_url:'https://example.com'>Our site</click>` | Text that opens a link                 |

A closing tag is optional. `<red>Hello` colours the rest of the line, while `<red>Hello</red> there` colours only the first word.

### Where it works

| Place                         | Notes                                             |
| ----------------------------- | ------------------------------------------------- |
| Chat messages                 | Everything in the language file that reaches chat |
| Crate holograms               | The floating text above a crate                   |
| Reward names and lore         | Including the rarity group display item           |
| Menu titles, item names, lore | Anywhere the editor lets you write text           |

### Where it doesn't work

Titles, subtitles, the action bar and boss bars only understand `&` codes. Those are sent as raw legacy text, so a tag in one of them is shown to the player exactly as you typed it.

### Usage notes

* Legacy `&` codes, including `&#RRGGBB` hex, keep working everywhere exactly as before.
* In **chat messages**, use one style per line. A chat line is only sent as MiniMessage when it contains no legacy colour codes at all, so mixing `&c` and `<red>` in the same line falls back to legacy and prints the tag.
* Everywhere else the two can be mixed freely. A hologram line or an item name is read as MiniMessage as soon as it contains a tag, and any `&` codes in it are converted along with it.
* A tag the server does not recognise is left in the text as written rather than being dropped, which is what keeps resource pack glyph tags working.

> **Warning:**
MiniMessage needs [Paper](https://papermc.io/) or a fork of it. On plain Spigot the tags are printed exactly as you typed them, so stay on `&` codes there.

Source: https://www.phoenixplugins.com/docs/phoenix-crates/configurations/languages