Translations
Every text the HUD shows — the settings menu, the vehicle menu and the notifications it sends itself — comes from a JSON file in locales/.
This page shows how to switch language, change a text, and add a language of your own.
Switching language
Set the file name, without .json, in editable/shared/config.lua:
KOJA.Locale = 'pl'| Code | Language |
|---|---|
en | English |
pl | Polski |
de | Deutsch |
es | Español |
fr | Français |
hi | Hindi |
Restart the resource. If the file does not exist, English is used.
Locale files are read at runtime, so — unlike js.json — no UI rebuild is needed.
What is in a locale file
Two top-level sections:
| Section | Used for |
|---|---|
ui | The settings menu (ui.settings) and the vehicle menu (ui.vehiclemenu) |
game | Notifications from the engine, nitro, cruise control and seatbelt, for example game.nitro.texts.no_nitro |
{
"ui": {
"settings": {
"main_title": "SETTINGS",
"notify_settings": {
"title": "Notification Settings"
}
},
"vehiclemenu": {
"title": "Vehicle Controls"
}
},
"game": {
"seatbelt": {
"notify": { "title": "Seatbelt" },
"texts": {
"seatbelt_on": "Seatbelt has been fastened!",
"seatbelt_off": "Seatbelt has been unfastened!"
}
}
}
}The title, description and label fields in options_settings are keys into ui.settings — "notify_settings.title" means ui.settings.notify_settings.title.
Changing a text
Edit the value in the file for your language and restart the resource. Keep the keys exactly as they are; only the values are yours to change.
Adding a language
-
Copy English
Copylocales/en.jsonto a new file named after the language code, for examplelocales/it.json. -
Translate the values
Translate every value. Leave the keys, and the structure, untouched. -
Select it
Restart the resource.editable/shared/config.luaKOJA.Locale = 'it'
Missing keys
- In the settings and vehicle menus, a key missing from your file falls back to the English text built into the UI.
- In notifications, a missing key is shown as the key itself, for example
game.nitro.texts.no_nitro. WithKOJA.Debug = truethe F8 console names every missing key.
After updating the HUD, compare your file with the new en.json — new features bring new keys.