🌍Localization

NOVA Framework has built-in multi-language support. Currently supports Portuguese (PT) and English (EN).

Core Localization

Using Translations

In any core module or script that depends on nova_core:

-- Server-side or shared (inside nova_core)
local text = _L('player_loaded')
local formatted = _L('admin_give_item', 'bread', 5, 'PlayerName')

Adding Core Translations

Portuguese: nova_core/config/locales/pt.lua

NovaLocale.RegisterLocale('pt', {
    ['my_key'] = 'Minha tradução',
    ['welcome_msg'] = 'Bem-vindo ao servidor, %s!',
})

English: nova_core/config/locales/en.lua

NovaLocale.RegisterLocale('en', {
    ['my_key'] = 'My translation',
    ['welcome_msg'] = 'Welcome to the server, %s!',
})

Setting the Language

In nova_core/config/main.lua:

Script Localization

Each launch script has its own locales.lua file with a self-contained system.

Structure

Using in Lua

Using in NUI (JavaScript)

Pass all strings to the NUI when opening:

Then apply in JavaScript:

Adding a New Language

  1. Add translations to nova_core/config/locales/ (e.g., es.lua for Spanish)

  2. Add translations to each script's locales.lua

  3. Set Config.Locale = 'es' in the core config

Last updated