> For the complete documentation index, see [llms.txt](https://hane-mod-studio.gitbook.io/hane-mod-studio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hane-mod-studio.gitbook.io/hane-mod-studio/hane-scripts/hane-dispatch/localization.md).

# Localization

Hane Dispatch includes a full locale system with Turkish and English translations out of the box.

***

### Setting the Language

In `shared/config.lua`:

```lua
Config.Locale = 'en' -- 'en' for English, 'tr' for Turkish
```

***

### How It Works

The locale system uses a simple key-value approach:

1. Locale files are stored in the `locales/` folder as `.lua` files.
2. On startup, the system loads the configured locale and falls back to English if not found.
3. Both server-side and NUI elements use the same locale keys.
4. Keys prefixed with `ui_` are automatically sent to the NUI interface.

***

### Adding a New Language

1. Create a new file in `locales/`, e.g., `locales/de.lua` for German.
2. Copy the structure from `locales/en.lua`.
3. Translate all values.

```lua
Locales['de'] = {
    ['ui_dispatch']           = 'EINSATZLEITUNG',
    ['ui_notifications']      = 'Benachrichtigungen',
    ['ui_units']              = 'Einheiten',
    ['ui_all_calls']          = 'Alle Einsätze',
    -- ... translate all keys
}
```

4. Set the locale in config:

```lua
Config.Locale = 'de'
```

***

### Locale Keys Reference

#### UI Keys (sent to NUI)

| Key                          | English Default                      |
| ---------------------------- | ------------------------------------ |
| `ui_dispatch`                | DISPATCH                             |
| `ui_notifications`           | Notifications                        |
| `ui_units`                   | Units                                |
| `ui_all_calls`               | All Calls                            |
| `ui_priority`                | Priority                             |
| `ui_code`                    | CODE                                 |
| `ui_no_active_calls`         | No active calls                      |
| `ui_new_calls_here`          | New calls will appear here           |
| `ui_responding`              | Respond                              |
| `ui_responded`               | Responding                           |
| `ui_dismiss`                 | Dismiss                              |
| `ui_responding_units`        | Responding Units                     |
| `ui_exit_hint`               | Press ESC or F6 to exit              |
| `ui_add_unit`                | Add Unit                             |
| `ui_create_unit`             | Create Unit                          |
| `ui_unit_name`               | Unit Name                            |
| `ui_cancel`                  | Cancel                               |
| `ui_confirm`                 | Confirm                              |
| `ui_available_officers`      | Available Officers                   |
| `ui_search_officers`         | Search Officers                      |
| `ui_drop_officers_available` | Drop officers here to make available |
| `ui_drop_officers_unit`      | Drop officers here                   |
| `ui_add_unit_start`          | Add a unit to get started            |
| `ui_available`               | Available                            |
| `ui_busy`                    | Busy                                 |
| `ui_enroute`                 | Enroute                              |
| `ui_unit_name_empty`         | Unit name cannot be empty!           |

#### Server / Client Keys

| Key                       | English Default                             |
| ------------------------- | ------------------------------------------- |
| `no_permission`           | You do not have permission for this action! |
| `no_permission_create`    | You do not have permission to create units! |
| `unit_created`            | Unit created: {1}                           |
| `unit_deleted`            | Unit deleted                                |
| `officer_already_in_unit` | This officer is already in a unit!          |
| `not_on_duty`             | You are not on duty!                        |
| `dispatch_responding`     | Responding to call                          |
| `dispatch_title`          | Dispatch                                    |
| `quick_respond_desc`      | Dispatch - Quick Respond                    |

> `{1}`, `{2}`, etc. are placeholders that get replaced with dynamic values at runtime.

***

### Using Locale in Code

```lua
-- Get a translated string
local text = L('unit_created', 'Alpha-1')
-- Result: "Unit created: Alpha-1"
```
