> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/easter-event/localization.md).

# Localization

Choose a language, edit texts or add your own translation.

The texts of the script are in the `locales/` folder, one JSON file per language. The folder is not encrypted.

## Choosing a language

```lua
-- config/shared.lua
Config.Locale = 'en'
```

| Code | Language |
| ---- | -------- |
| `en` | English  |
| `pl` | Polish   |
| `de` | German   |
| `cs` | Czech    |
| `es` | Spanish  |
| `fr` | French   |
| `it` | Italian  |
| `sv` | Swedish  |

The language is the same for every player on the server. Restart the resource after changing it.

## Editing a text

Open `locales/<code>.json`, change the value on the right and restart the resource. Do not change the key on the left.

```json
"boss_appeared": "The Easter Boss has appeared on the map! Find it and press [E] to attack!",
```

The keys are grouped by their prefix:

| Prefix             | Used for                                                           |
| ------------------ | ------------------------------------------------------------------ |
| `ui_`              | The case opening screen and the admin panel                        |
| `textui_`          | Interaction prompts next to eggs, rabbits, the boss and the trader |
| `blip_`            | Map names of the late reveal dots                                  |
| `keybind_`         | Names of the keys in the GTA key binding settings                  |
| `scoreboard_edit_` | The scoreboard placement tool                                      |
| `admin_`           | Results of admin panel actions                                     |
| `log_`             | Server console messages                                            |
| `log_webhook_`     | Discord messages                                                   |
| the rest           | Notifications for players                                          |

## Placeholders

Some texts contain `%s` or `%d`. They are replaced with a value when the text is shown: `%s` with a text, `%d` with a number. Keep all of them, in the same order.

```json
"boss_hit_message": "You hit the boss! Remaining HP: %d/%d",
"pity_exchanged": "Exchanged %d shells for %dx %s!",
```

Two spaces followed by `\n` inside a prompt text start a new line.

## Adding a language

{% stepper %}
{% step %}

### Copy the English file

Copy `locales/en.json` to `locales/xx.json`, where `xx` is your language code.
{% endstep %}

{% step %}

### Translate the values

Translate the text on the right side of every line. Leave the keys and the placeholders as they are.
{% endstep %}

{% step %}

### Select it

Set `Config.Locale = 'xx'` in `config/shared.lua` and restart the resource.
{% endstep %}
{% endstepper %}

A key that is missing from your file is shown in English.

## Texts that are in the config

Names that you are likely to change together with a location are in `config/shared.lua`, not in the language files:

| Text                             | Option                                                |
| -------------------------------- | ----------------------------------------------------- |
| Zone names                       | `label` of each entry in `Config.Spawner.zones`       |
| Name of the blip group           | `Config.Blips.categoryName`                           |
| Boss blip name                   | `Config.Boss.blip.label`                              |
| Trader name and blip name        | `Config.Pity.npc.label`, `Config.Pity.npc.blip.label` |
| Item names in the admin Loot tab | `label` of each entry in `Config.EggLoot`             |

Item names in the case opening and in notifications come from your inventory, so change those in the item definitions.
