> For the complete documentation index, see [llms.txt](https://cylexdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cylexdev.gitbook.io/docs/cylex_mdt/guides/localization.md).

# Localization

Switch the MDT interface language, adjust date and number formatting with a BCP-47 tag, and add a brand-new language by copying a locale file.

Cylex MDT ships with two ready-to-use locale files — English and Turkish — and is designed so that you can add any language by copying one file and translating the strings inside it. The active language and date formatting are both controlled from `editable/config.lua`.

### Supported languages <a href="#b3b01133-5325-44b4-a463-0a2a6ec30d2b" id="b3b01133-5325-44b4-a463-0a2a6ec30d2b"></a>

| Key  | Language |
| ---- | -------- |
| `en` | English  |
| `tr` | Turkish  |

### Setting the active language <a href="#id-8cd9fda7-0345-4aef-8a2a-4a8b8be75095" id="id-8cd9fda7-0345-4aef-8a2a-4a8b8be75095"></a>

Open `editable/config.lua` and set `Config.Locale` to the key that matches the locale file you want to use:

```lua
-- editable/config.lua
Config.Locale = 'en'   -- 'en' | 'tr' | or any key you add
```

The value must match exactly the key used in the `Locales` table inside the locale file (e.g. `Locales['en']` or `Locales['tr']`).

### Date and number formatting <a href="#c623afd5-0859-41d1-bbe2-c81d3730de09" id="c623afd5-0859-41d1-bbe2-c81d3730de09"></a>

`Config.DateLocale` accepts any [BCP-47 language tag](https://www.ietf.org/rfc/bcp/bcp47.txt) and controls how dates, times, and numbers are formatted throughout the MDT — independent of the interface language.

```lua
-- editable/config.lua
Config.DateLocale = 'tr-TR'   -- e.g. 'en-US', 'en-GB', 'de-DE', 'fr-FR'
```

You can set `Config.Locale = 'en'` (English interface) while keeping `Config.DateLocale = 'en-GB'` for DD/MM/YYYY date formatting, for example.

### Locale files <a href="#id-4650ef8d-8146-4534-8e28-ad254b174fc3" id="id-4650ef8d-8146-4534-8e28-ad254b174fc3"></a>

Locale files live in `editable/locales/`. Each file exports a table keyed by the locale identifier:

* `editable/locales/en.lua` → `Locales['en']`
* `editable/locales/tr.lua` → `Locales['tr']`

Every label, placeholder, button text, and page title in the MDT is sourced from these files. The resource falls back to `Locales['en']` if the configured locale is not found.

### The dataMap block <a href="#id-638be128-a96d-48a3-8c85-c0d0520b332b" id="id-638be128-a96d-48a3-8c85-c0d0520b332b"></a>

At the bottom of each locale file is a `dataMap` block. This block translates the canonical ENUM values stored in the database into the display language. These are **not** free-text labels — they are exact string matches against values that come back from the database.

```lua
-- editable/locales/tr.lua (excerpt)
dataMap = {
    ['open']               = 'Açık',
    ['closed']             = 'Kapatıldı',
    ['under_investigation'] = 'Soruşturmada',
    ['archived']           = 'Arşivlendi',
    ['Active']             = 'Aktif',
    ['Resolved']           = 'Çözüldü',
    ['Expired']            = 'Süresi Doldu',
    ['In Lab']             = 'Laboratuvarda',
    ['Processed']          = 'İşlendi',
    ['Sealed']             = 'Mühürlendi',
    ['Critical']           = 'Kritik',
    ['High']               = 'Yüksek',
    ['Medium']             = 'Orta',
    ['Low']                = 'Düşük',
    ['WANTED']             = 'ARANIYOR',
    ['CAPTURED']           = 'YAKALANDI',
},
```

The `dataMap` translates: incident statuses (`open`, `closed`, `under_investigation`, `archived`), evidence statuses (`Active`, `In Lab`, `Processed`, `Sealed`), incident priorities (`Critical`, `High`, `Medium`, `Low`), and suspect statuses (`WANTED`, `CAPTURED`).

{% hint style="info" %}
If statuses or priority labels appear in English even after setting `Config.Locale`, the `dataMap` block in your locale file is either missing entries or has mismatched keys. The keys are case-sensitive and must match the exact ENUM values stored in the database.
{% endhint %}

### Sidebar group labels <a href="#fdb40fd0-2b1c-4feb-9c33-4147e5eab81b" id="fdb40fd0-2b1c-4feb-9c33-4147e5eab81b"></a>

The collapsible sidebar groups ("Administration" and "Department" by default) pull their display names from the locale file under `sidebar.groups`:

```lua
-- editable/locales/en.lua (excerpt)
sidebar = {
    groups = {
        management  = 'Administration',
        departments = 'Department',
    },
}
```

Translate these values in your locale file to rename the sidebar group headings.

### Adding a new language <a href="#id-610aa06b-301f-40d3-a7a9-30ecda863758" id="id-610aa06b-301f-40d3-a7a9-30ecda863758"></a>

{% stepper %}
{% step %}

### Copy the English locale file

Duplicate `editable/locales/en.lua` and rename it to match your target language code, for example `editable/locales/de.lua` for German.
{% endstep %}

{% step %}

### Update the Locales table key

At the top of the new file, change `Locales['en']` to `Locales['de']` (or whichever key you chose). The key must match the value you will set for `Config.Locale`.
{% endstep %}

{% step %}

### Translate the string values

Go through the file and replace every English string value with the translated equivalent. Do **not** change the keys — only change the values on the right-hand side of the `=`.
{% endstep %}

{% step %}

### Translate the dataMap block

Near the bottom of the file, update the `dataMap` block so that each database ENUM value maps to its translated display string. These entries are required for status labels, priority labels, and felony class names to appear in the correct language.
{% endstep %}

{% step %}

### Set Config.Locale

In `editable/config.lua`, set `Config.Locale` to your new key:

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

{% endstep %}

{% step %}

### Restart the resource

Run `ensure cylex_mdt` in the server console. The MDT will load the new locale on the next client connection.
{% endstep %}
{% endstepper %}
