> 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/dart-game/localization.md).

# Localization

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

Every text shown to players is in the `locales/` folder, one JSON file per language. The folder is not encrypted.

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

## Choosing a language

Set the convar in `server.cfg`, above the `ensure kossek_darts` line:

```cfg
setr kossek_darts:locale "en"
```

The value is the file name without `.json`. Use `setr`, not `set`: the client reads the value too.

## Editing texts

Open the file of your language and change the text on the right side. Leave the key on the left as it is.

```json
"bullseye": "BULLSEYE! 50 points"
```

Restart the resource to see the change.

## Adding a language

{% stepper %}
{% step %}

### Copy the English file

Copy `locales/en.json` to a new file named after your language, for example `locales/pt.json`.
{% endstep %}

{% step %}

### Translate the values

Translate the text on the right side of every line. Keep the keys and the placeholders.
{% endstep %}

{% step %}

### Select it

```cfg
setr kossek_darts:locale "pt"
```

{% endstep %}
{% endstepper %}

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

## Placeholders

Some texts contain `%s` or `%d`. The script puts a value there, so keep them in your translation, in the same order.

| Key                      | English text                                         | Value                                    |
| ------------------------ | ---------------------------------------------------- | ---------------------------------------- |
| `join`                   | `Press ~INPUT_PICKUP~ to join the game\nPlayers: %d` | Players in the lobby                     |
| `hit_points`             | `You hit for %d points`                              | Points scored                            |
| `triple`                 | `TRIPLE %d!`                                         | Sector that was hit                      |
| `double`                 | `DOUBLE %d!`                                         | Sector that was hit                      |
| `your_turn`              | `Your turn! Dart %d of %d`                           | Dart number, darts per turn              |
| `wait_turn`              | `Waiting for %s...`                                  | Name of the player throwing              |
| `match_won`              | `%s wins the match!`                                 | Name of the winner                       |
| `lobby_full`             | `This board is full (%d players)`                    | `Config.MaxPlayers`                      |
| `xp_gained`              | `+%d XP`                                             | XP amount                                |
| `level_up`               | `Level up! Now level %d`                             | New level                                |
| `invited_by`             | `%s invited you to play darts!`                      | Name of the inviting player              |
| `board_saved`            | `Board %s saved successfully`                        | Board id                                 |
| `board_deleted`          | `Board %s deleted`                                   | Board id                                 |
| `board_exists`           | `A board with ID %s already exists`                  | Board id                                 |
| `delete_confirm_content` | Text of the delete confirmation dialog               | Board name, board id, distance in metres |

## Key groups

| Keys                                                                                      | Where they are shown                           |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `missed`, `hit_points`, `bullseye`, `bull`, `triple`, `double`, `bust`                    | Notification after each dart                   |
| `your_turn`, `wait_turn`, `turn_timer`, `you_won`, `match_won`, `xp_gained`, `level_up`   | Match flow                                     |
| `lobby_full`, `not_initiator`, `match_in_progress`, `versus_needs_two`                    | Lobby errors                                   |
| `invite_title`, `invited_by`, `invite_accept`, `invite_decline`                           | Invite dialog                                  |
| `target_join`, `target_leave`                                                             | Labels of the ox\_target and qb-target options |
| `join`, `leave`                                                                           | Text prompt of the `helptext` target option    |
| `btn_aim`, `btn_throw`, `btn_cancel`                                                      | Button hints at the bottom of the screen       |
| `not_admin`, `board_*`, `invalid_pos`, `creator_hint_*`, `dialog_*`, `delete_*`, `list_*` | Admin board commands                           |
| `ui_*`                                                                                    | Lobby panel, in-game HUD and scoreboard        |
