> For the complete documentation index, see [llms.txt](https://doc.var-fivem.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.var-fivem.com/coins-shop/configuration/languages.md).

# Languages

Var Coins Shop ships with FR / EN / ES translations. Adding a language is a 2-step process.

### Configure available languages

In `shared/config.lua`:

```lua
Language = {
  Default = "en",
  Fallback = "en",
  AllowClientSelection = false, -- true = the player can change language from the UI
  Available = {
    fr = { label = "Francais" },
    en = { label = "English" },
    es = { label = "Espanol" },
  }
}
```

| Key                    | Effect                                                  |
| ---------------------- | ------------------------------------------------------- |
| `Default`              | Locale used for new accounts                            |
| `Fallback`             | Locale used when a translation key is missing           |
| `AllowClientSelection` | If false, the player cannot change language from the UI |
| `Available`            | Map of locale code → label shown in UI                  |

### Add a new language

Example: add German.

**Step 1.** Add the entry in `Available`:

```lua
Available = {
  fr = { label = "Francais" },
  en = { label = "English" },
  es = { label = "Espanol" },
  de = { label = "Deutsch" }, -- new
}
```

**Step 2.** In `shared/locales.lua`, copy the existing `en = { ... }` block and translate it:

```lua
de = {
  shop = {
    title = "Cash-Shop",
    -- ...
  },
  errors = {
    insufficientFunds = "Nicht genug Coins.",
    -- ...
  },
}
```

The script will automatically pick up the new locale on resource restart.

### Per-player locale persistence

Each player's locale is stored in `coins_shop_accounts.locale`. It is updated when:

* The player switches language from the UI (only if `AllowClientSelection = true`)
* You call the server event `var-shop:setLocale` from a custom flow

The `localeUpdate` webhook is fired on every change.
