Skip to content

Localization

Localization

BUPA Chat is fully translatable. Translations are plain JSON files under locales/, loaded by ox_lib (the manifest declares ox_lib 'locale'), and read through the t() wrapper.

Shipped languages

locales/*.json — ten languages out of the box:

Code Language Code Language
en English nl Dutch
tr Turkish pl Polish
de German pt Portuguese
es Spanish ru Russian
fr French it Italian

Every UI string, category label, placeholder, emote description and system message resolves from these files.

Selecting the language

The active language is resolved in shared/config/core.lua:

shared/config/core.lua
config.lang = GetConvar("bupa-chat:locale", GetConvar("ox:locale", "en"))

Resolution order:

  1. bupa-chat:locale — a per-resource override for BUPA Chat only.
  2. ox:locale — the shared ox_lib locale used across your server.
  3. en — English fallback if neither is set.
server.cfg
setr ox:locale "tr"          # server-wide language
setr bupa-chat:locale "en"   # optional: force English for chat only

Runtime switching — bupa:changeLanguage

You can change a player's language live, per session, without a restart. Trigger the client event with a language code; BUPA Chat reloads that locale via ox_lib and pushes it straight to the React UI:

client
TriggerEvent("bupa:changeLanguage", "de")

Internally this calls loadLang(newLang) (which switches ox_lib's active locale) and then changeUiLang, so both the Lua side and the UI update together.

Adding or editing a language

locales/ is in escrow_ignore, so you can edit the JSON directly. To add a language, copy en.json, translate the values, and save it as <code>.json (e.g. sv.json), then point ox:locale or bupa-chat:locale at that code.

locales/en.json
{
  "CATEGORY_COMMANDS_LABEL": "Commands",
  "CATEGORY_COMMANDS_PLACEHOLDER": "Type a command...",
  "CATEGORY_ADMIN_LABEL": "Admin Chat",
  "EMOTE_ME_COMMAND_DESC": "Describe an action you are doing"
}

t() (and ox_lib locale()) return the key itself when a translation is missing. Keep en.json complete as your reference, and use %s / %d placeholders for dynamic values (e.g. "Reason: %s").