# 🌍 Languages & Translations

## Translations

Every line the plugin can print lives in one file:

```
PhoenixShop/translations/translations.en.yml
```

Messages to players, command replies, the menus and the whole in-game editor are all in there. Edit it and run /pshop reload to apply the new text. Player shop signs show it after their next trade or restock.

## Language

The plugin ships with English only, and there is no language option. To run it in another language, translate the file yourself.

## Translating the plugin

Everything sits under `en` 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:
  cannot-buy: "%prefix%&f%item% &cis not for sale here."
  shop-currency-missing:
    - "%prefix%&cThe shop &f%shop%&c cannot open: it is priced in &f%currency%&c."
    - "&7Install &f%plugin%&7 and run &f/pshop reload&7."
```

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

## The Prefix

`%prefix%` at the start of a message is replaced with the `plugin-prefix` line, so the prefix of every message is changed in one place.

```yaml
en:
  plugin-prefix: "&#7852A9&lPhoenixShop &8» &7"
```

Remove `%prefix%` from a message to send that one without it. Set `plugin-prefix` to `''` to drop it everywhere.

## Updating the plugin

New keys reach your file on their own. On start, any key the plugin ships that your file does not have is written into it with its English default, and the console prints `Missing value for key "..."` for each one.

Keys you already have are never touched. A message whose default wording changed in an update keeps your old text, so compare with the file inside the new jar if you want the new wording.

> **Info:**
Keep a copy of your translated file before updating the plugin. New keys are added to it automatically, 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 Shop understands [MiniMessage](https://docs.advntr.dev/minimessage/format.html) tags, like `<red>`, `<bold>` or `<gradient:#ff5555:#5555ff>`, on top of the classic `&` colour codes and `&#RRGGBB` hex colours.

### Format

| Example                                               | Result                                 |
| ----------------------------------------------------- | -------------------------------------- |
| `&aHello`                                             | Green text                             |
| `&#ff8800Hello`                                       | Any hex colour                         |
| `<#ff8800>Hello`                                      | Any hex colour, MiniMessage style      |
| `<gradient:#FF9A00:#E52D27>Phoenix Shop</gradient>`   | Text fading from one colour to another |
| `<bold><underlined>Warning`                           | Bold and underlined                    |
| `<rainbow>Rare!</rainbow>`                            | Each letter a different colour         |

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                                               |
| ---------------------------------- | --------------------------------------------------- |
| Shop and category names            | The shop's display name and the category's title    |
| Item names and lore                | Including purchase items                            |
| Menu titles, item names and lore   | Everything in the `menus` files                     |
| Sign shops                         | The lines of chest shops and server-owned sign shops |
| Message, title and action bar actions ⭐ | Actions run by requirements and categories    |

In these places `&` codes and tags can be mixed freely in the same line.

### Where it doesn't work

Messages in the translation file, such as the bought and sold messages, only understand `&` codes and `&#RRGGBB` hex. A tag in one of them is shown to the player exactly as you typed it.

Hover text and clickable links are not supported anywhere, since every text is turned into plain coloured text before it is shown.

### Usage notes

* 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.
* Bedrock forms drop hex colours and gradients, and keep the standard `&` colours.

> **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-shop/configurations/languages