PiTyUs.Hire me

Engineering

Translating FiveM scripts into other languages

Add translations to FiveM scripts: ox_lib’s locale system with locales/*.json and the ox:locale convar, ESX Legacy Translate/TranslateCap, QBCore’s Locale and Lang:t, placeholders, NUI translations, fallbacks, and a workflow for community translations.

Updated 9 min readBy PiTyUs · FiveM developer

Overview

FiveM servers run in dozens of languages, and a script that ships only English text loses most of its possible buyers. Moving text into locale files is a small change that makes your resource translatable by the community — and easier to maintain.

ox_lib locales

fxmanifest.lualua
shared_script '@ox_lib/init.lua'
ox_lib 'locale'

files { 'locales/*.json' }
locales/en.jsonjson
{
  "stored": "Vehicle %s stored",
  "no_money": "You need $%d"
}
client.lualua
lib.notify({ description = locale('stored', plate) })

Owners pick the language with setr ox:locale de in server.cfg; missing languages fall back to English. More on ox_lib: the ox_lib guide.

ESX and QBCore

FrameworkFilesUsage
ESX Legacylocales/en.lua with Locales['en'] = { ... }TranslateCap('key') / Translate('key')
QBCorelocales/en.lua with Locale:new({ phrases = ... })Lang:t('key', { value = x })

For multi-framework scripts, ox_lib’s system is the simplest single choice — see framework bridges.

Translating the UI

client.lualua
SendNUIMessage({ action = 'locale', data = lib.getLocales() })

Send the whole table once when the UI starts and look strings up in JavaScript, instead of sending text with every message. NUI patterns: NUI to Lua communication.

A translation workflow

  • Keys that describe meaning (impound_fee), not English text.
  • Placeholders for numbers and names — word order differs between languages.
  • Accept community pull requests for new locale files; credit translators.
  • Keep all locale files in escrow_ignore.

Frequently asked questions

How do I add translations with ox_lib?

Add ox_lib 'locale' to the fxmanifest, create locales/<lang>.json, and call locale('key'). Owners choose the language with setr ox:locale <code>.

How do ESX scripts translate text?

With locale tables and TranslateCap('key') / Translate('key').

How do QBCore scripts translate text?

With Locale:new({ phrases = ... }) and Lang:t('key').

How do I translate my NUI?

Send the locale table to the UI once and look strings up in JavaScript.

Need this built, not just explained?

Ten years of FiveM work, from Lua to NUI

Custom resources, React NUI, ESX / QBCore / Qbox integration, OneSync performance audits and security reviews — plus the websites and SEO around your server brand.

Related guides