> 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-weapon-studio/languages.md).

# Languages

CAS Weapon Studio languages. English, Turkish, German, French, Spanish, Portuguese (Brazil), Russian and Polish are shipped, and you can add your own with one JSON file.

Every text staff and players see comes from a language file: the studio, the skin book, the prompts and the messages.

## Shipped languages

| Code    | Language            | File                 |
| ------- | ------------------- | -------------------- |
| `en`    | English             | `locales/en.json`    |
| `tr`    | Turkish             | `locales/tr.json`    |
| `de`    | German              | `locales/de.json`    |
| `fr`    | French              | `locales/fr.json`    |
| `es`    | Spanish             | `locales/es.json`    |
| `pt-BR` | Portuguese (Brazil) | `locales/pt-BR.json` |
| `ru`    | Russian             | `locales/ru.json`    |
| `pl`    | Polish              | `locales/pl.json`    |

## Choosing the language

Set the code in `config.lua`:

```lua
Config.Locale = "en"
```

One language for the whole server. The change takes effect after a restart.

## Adding your own language

1. Copy `locales/en.json` to `locales/<code>.json`, for example `locales/it.json`. `locales/template.json` lists every key with an empty value if you prefer to start from that.
2. Translate the values. Do not change the keys on the left.
3. Keep every `{placeholder}` exactly as it is, for example `{name}`, `{price}`, `{slot}`.
4. Set `Config.Locale = "it"`.
5. Restart.

```json
{
 "book.buy": "Compra",
 "book.bought": "Hai comprato {name} per {price}.",
 "book.apply": "Indossa"
}
```

Rules:

* A key your file leaves out, or leaves empty, shows in English.
* A key that starts with `_` is a note and is ignored (the template's `_readme`).
* When the file is missing or broken, everything shows in English and the client console prints `[cas-weaponstudio] locales/<code>.json is missing or broken, using English`.
* Save the file as UTF-8.

The language files stay readable in the escrow build, so you can change any wording, in English too.

## What is not in the language files

* Town names: `label` in `Config.Towns`.
* Job names: `Config.Jobs`, shown as your framework stores them.
* Weapon names in the studio and the book: they come from the weapon library, in English.
* The names staff give to skins and custom guns.
