> For the complete documentation index, see [llms.txt](https://organized-chaos.gitbook.io/organized-chaos-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://organized-chaos.gitbook.io/organized-chaos-docs/editing-config-and-languages.md).

# Editing config and languages

How to change settings, translate a resource and keep your changes through an update.

## Changing a setting

1. Open the resource's `config.lua` in a text editor.
2. Change the value. Every option has a comment above it that says what it does and which values it takes.
3. Save the file and restart the resource: `restart <name>` in the server console.

{% hint style="info" %}
If the resource stops loading after an edit, the file almost always has a syntax error: a missing comma between two entries, or a missing quote or closing bracket. The server console names the line.
{% endhint %}

## Settings that stay on the server

`config.lua` is sent to every player, so nothing secret belongs in it. Chess, Dice Kings, Rummiduck, Quicks, Duck Down and Quackmobil keep their Discord logging in a second file, `config_server.lua`, which is loaded on the server only. You edit it the same way. Each product has a Discord logging page that describes it.

The Lost Treasure keeps its server-only settings in the `config/server/` folder.

## Choosing a language

Chess, Dice Kings, Rummiduck, Quicks and Duck Down come with English and German. Set the language in `config.lua`:

```lua
Config.Locale = 'en'   -- or 'de'
```

Two products handle their words differently:

* **The Lost Treasure** keeps them in two files of its own. See its [Language](/organized-chaos-docs/the-lost-treasure/language.md) page.
* **Quackmobil** has only a handful of texts. They are in `Config.Locale` inside its `config.lua`, and you translate them in place.

## Adding a language

This applies to Chess, Dice Kings, Rummiduck, Quicks and Duck Down. The words are in `locales.lua`, one block per language.

1. Copy the whole English block, from `Locales.en = {` to its closing `}`.
2. Paste it below and rename it, for example `Locales.fr = {`.
3. Translate the text between the quotes.
4. Set `Config.Locale = 'fr'` in `config.lua` and restart the resource.

Three things to leave as they are:

* **Placeholders** such as `%s` and `%d`. They are filled in with a name or a number while the game runs. Keep each one, in the same order.
* **Key tokens** such as `~INPUT_PICKUP~`. The game replaces them with the key the player has bound.
* **The names on the left** of each `=`. Only translate what is between the quotes.

{% hint style="warning" %}
Copy the block completely, including the inner `ui = { ... }` part. A message that is missing falls back to English, but the words on the game board are taken from your language as a whole. A board with a missing line shows nothing in its place.
{% endhint %}

To change a single word, edit it in the block of the language you use. There is no need to add a language for that.

## Keeping your changes through an update

A new version from the Portal replaces the whole folder. Before you overwrite it, keep a copy of:

* `config.lua`, `config_server.lua` and `locales.lua` (for The Lost Treasure, the `config/` folder)
* the files a resource writes itself, such as `tables.json`, `stats.json`, `owed.json` and `games.pgn`. Each product page lists its own.

After the update, compare your copy of `config.lua` with the new one. A new version may add options, and an option that is missing from an old config has no value at all.
