> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-duel-arena-system/languages.md).

# Languages and Translation

Translate the RedM Duel & Arena System. English and Turkish are included. Switch language with one setting or add your own, covering the menu, duel HUD, notifications and server messages.

Every word players see comes from one language file: the menu, the duel HUD, notifications, server messages, admin replies and the hold prompts for answering a challenge. Change one setting to switch language, or copy a file to add your own. The interface does not need to be rebuilt.

## Included languages

| Code | Language | File             |
| ---- | -------- | ---------------- |
| `en` | English  | `locales/en.lua` |
| `tr` | Turkish  | `locales/tr.lua` |

## Choosing the language

Set `Config.Locale` in `config.lua` and restart the resource:

```lua
Config.Locale = 'tr'
```

```
restart cas-duel
```

Each player's menu receives the chosen language every time it opens, so everyone on the server sees the same language.

## Adding a language

1. Copy `locales/en.lua` and name the copy after your language code, for example `locales/de.lua`.
2. Change the first table line from `Locales['en']` to `Locales['de']`.
3. Translate the text on the right-hand side of every line. Leave the keys on the left unchanged.
4. Set `Config.Locale = 'de'` and restart the resource.

Any line you leave out falls back to English, so you can translate a little at a time.

### Rules for translated text

| You see             | Meaning                                                                                                                                       |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `%s`                | A value filled in by the script, such as a name, an amount or a number. Keep every `%s`, in the same order.                                   |
| `%%`                | A literal percent sign. `'%s%%'` shows `64%`; `'%%%s'` shows `%64`.                                                                           |
| `_one` and `_other` | The same text for one item and for several, for example `'%s duel'` and `'%s duels'`. Fill in both, even if your language uses the same word. |

{% hint style="warning" %}
The three `prompt_` lines (`prompt_accept`, `prompt_decline`, `prompt_group`) are drawn by the game itself, not by the menu. The game can only show plain English letters there; accented and special characters appear as empty boxes. Write them without accents, as the Turkish file does with `'Duelloyu kabul et'`.
{% endhint %}

The menu fonts cover accented Latin letters (Turkish, German, French, Spanish, Portuguese, Italian, Polish, Czech and more) and Cyrillic. Other scripts are drawn with a fallback system font.

The menu also sets the page language, so capital letters follow the rules of the chosen language. In Turkish, for example, `i` becomes `İ`.

## Names of modes, arenas and other content

Content defined in `config.lua` gets its name from the language file by its id:

| Config entry             | Language key                                                 |
| ------------------------ | ------------------------------------------------------------ |
| Mode `classic`           | `mode_classic`, and `mode_classic_blurb` for its description |
| Arena `lagras`           | `arena_lagras`                                               |
| Arena region `bayou_nwa` | `region_bayou_nwa`                                           |
| Arena kind `town`        | `arena_kind_town`                                            |
| Weapon `cattleman`       | `weapon_cattleman`                                           |
| Outlaw `legend`          | `npc_legend_name`, `npc_legend_foe`, `npc_legend_blurb`      |
| Tournament `valentine`   | `tournament_valentine`                                       |
| Title `unbroken`         | `title_unbroken`                                             |
| Achievement `a4`         | `ach_a4_name`, `ach_a4_desc`                                 |
| Season                   | `season_name`                                                |

Queue names are built for you from the ranked or casual tag and the mode name, for example `Ranked · Classic Duel`.

When you add something new, such as an arena with the id `main_street`, add its key to every language file you use:

```lua
arena_main_street = 'Main Street',
```

A missing arena, mode, weapon, outlaw or tournament name falls back to its id with each word capitalised, so `main_street` shows as `Main Street`.

### Fixed names in config.lua

To use one name in every language, set it in `config.lua`. A name written there always wins over the language file:

| Config entry                    | Field                     |
| ------------------------------- | ------------------------- |
| Mode, queue, tournament, season | `name = '...'`            |
| Arena                           | `label = '...'`           |
| Outlaw                          | `name`, `foe` and `blurb` |
| Title                           | `text = '...'`            |
| Achievement                     | `name` and `desc`         |

For an arena, `region` and `kind` can also be plain text instead of an id. Text that does not match a key in the language file is shown as written.

## What stays in English

Status and error lines in the server console, such as the framework it detected, the entries written to `arena_log.txt` and the reason attached to RSG Core money transactions are always in English, so logs read the same on every server. Players never see them.
