<script>
	import Callout from '$lib/components/Callout.svelte';
</script>

dd-cards uses ox_lib's locale system. Every player-visible string — the NUI, the menus, the target
labels, the notifications and the errors — comes from a JSON file in `locales/`.

## Setting the language

dd-cards follows ox_lib's locale convar. Set it in your `server.cfg`:

```cfg
setr ox_locale "en"
```

Only `en.json` ships. Setting a convar for a locale file that does not exist will leave strings
unresolved, so add the file first.

## Adding a language

1. Copy `locales/en.json` to `locales/<code>.json` — for example `locales/de.json`.
2. Translate the **values**. Leave every key exactly as it is; keys are what the resource looks up.
3. Set `setr ox_locale "de"` and restart.

New files are picked up automatically — `fxmanifest.lua` already ships `locales/*.json`, so there is
nothing to register.

<Callout type="warning">
Keep the `%s` placeholders. `menu.order_title` and `menu.order_printing` are formatted with values
at runtime, so a translation that drops or reorders `%s` will render wrong or error.
</Callout>

## Structure

The file has five top-level sections:

| Section       | Covers                                                                  |
| -------------- | ---------------------------------------------------------------------------- |
| `ui.designer` | The card designer NUI — tools, shapes, order summary, pickup, templates |
| `ui.viewer`   | The card viewer shown when a player uses a `business_card`              |
| `ui.common`   | Shared UI strings — close, back, loading, generic error                |
| `target`      | The third-eye / walk-up label, `Open Business Center`                   |
| `menu`        | The business centre and order list                                      |
| `notify`      | Order submitted, order ready, template saved/deleted, pickup success    |
| `error`       | Every failure message a player can see                                  |

## Placeholders in full

Only two strings take a format argument:

```json
"order_title": "%s business cards",
"order_printing": "Printing — ready in about %s min",
```

`order_title` receives the quantity, `order_printing` the minutes remaining.

## Error strings

These are the messages your players will actually report to you, so they are worth reading before
translating — several are diagnostic rather than cosmetic:

```json
"error": {
    "invalid_design": "That design isn't valid",
    "template_not_found": "Template not found",
    "template_slots_full": "You've used all 5 template slots. Delete one first.",
    "not_enough_money": "You don't have enough money",
    "not_enough_cash": "You don't have enough cash on you",
    "not_enough_bank": "You don't have enough money in the bank",
    "price_changed": "The price changed, check the order again",
    "order_not_ready": "That order isn't ready yet",
    "inventory_full": "You don't have space for that",
    "box_unreadable": "That box couldn't be read from your inventory",
    "box_wrong_item": "That isn't a business card box",
    "box_no_design": "That box has lost the design it was printed from",
    "box_empty": "That box is empty"
}
```

What several of them mean is covered on [Troubleshooting](/docs/dd-cards/troubleshooting).

<Callout type="note">
`template_slots_full` names the number 5 in the English string. The five-slot limit is fixed in the
resource, so if you translate this string, keep the number.
</Callout>
