> 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-radio/localization.md).

# Localization

Hane Radio uses a JSON-based locale system with Turkish and English translations included.

***

### Setting the Language

In `config/config.lua`:

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

***

### How It Works

Unlike the Lua-based locale systems in Dispatch and GPS, Hane Radio uses JSON files for translations:

* Locale files are stored in `locales/` as `.json` files.
* The `locales/locales.lua` handler loads the JSON file at startup.
* Both Lua code and NUI share the same locale strings.
* The `L(key, ...)` function provides formatted translations.

***

### Adding a New Language

1. Create a new JSON file in `locales/`, e.g., `locales/de.json`.
2. Copy the structure from `locales/en.json`.
3. Translate all values while keeping the keys unchanged.

Example structure:

```json
{
    "radio_title": "Funkgerät",
    "frequency": "Frequenz",
    "connect": "Verbinden",
    "disconnect": "Trennen",
    "emergency": "Notfall",
    "send_location": "Standort senden",
    "text_message": "Textnachricht",
    "favorites": "Favoriten",
    "recent": "Letzte",
    "settings": "Einstellungen",
    "admin_panel": "Admin-Panel"
}
```

4. Set the locale in config:

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

***

### Using Locale in Code

#### Lua

```lua
-- Simple key lookup
local text = L('radio_title')

-- With format arguments
local text = L('user_joined', playerName, frequency)
```

#### Via Export

```lua
local text = exports['hane_radio']:GetLocale('emergency_sent')
```

> The NUI automatically receives all locale strings on initialization and uses them for all UI text.
