PONEGLYPHSTUDIOS

Reference

Languages

Five built-in languages (EN/ES/FR/DE/PT) and how to add or edit one through the open locale files.

PSTUDIOS-HUD ships with five languages out of the box. You pick one with Config.Locale and you can edit or add more, because the locale files are left open under escrow.

Built-in languages

  • English ('en')
  • Spanish / Espanol ('es')
  • French / Francais ('fr')
  • German / Deutsch ('de')
  • Portuguese / Portugues ('pt')

Set the active language in config.lua. The default value is 'es'. See Configuration (config.lua) for where this option lives.

Config.Locale = 'es'  -- 'es' / 'en' / 'fr' / 'de' / 'pt'
Choosing the HUD language in config.lua.

Editable locale files (escrow_ignore)

When the resource is protected through keymaster escrow, everything is encrypted EXCEPT the files listed in escrow_ignore. The locale files are explicitly left open, so you can translate and add languages without touching protected code.

escrow_ignore {
    'config.lua',         -- el cliente ajusta todo desde aqui
    'locales/*.lua',      -- traducciones editables / anadir idiomas
    'README.md',
    'CHANGELOG.md',
}
From fxmanifest.lua: locales/*.lua is left editable so you can translate and add languages.

What can be translated

Each locale file defines two groups of strings: the key-binding descriptions (toggle HUD, seatbelt, cruise control, open settings) and the NUI strings (no-route and waypoint labels, unit labels for km/h, mph and knots, and the settings menu labels). Compass cardinals use the international N/NE/E convention and are not translated.

How to add a new language

  1. Copy locales/en.lua to locales/xx.lua (replace xx with your language code).
  2. Translate the strings inside, keeping the keys unchanged.
  3. Register the new file in fxmanifest.lua under client_scripts.
  4. Set Config.Locale = 'xx' and restart the resource.
Locales = Locales or {}
Locales['es'] = {
    key_togglehud = 'PSTUDIOS-HUD: mostrar/ocultar HUD',
    key_seatbelt  = 'PSTUDIOS-HUD: cinturon',
    key_cruise    = 'PSTUDIOS-HUD: control de crucero',
    key_menu      = 'PSTUDIOS-HUD: abrir ajustes',

    nui = {
        noRoute = 'SIN RUTA',
        waypoint = 'DESTINO',
        kmh = 'KM/H', mph = 'MPH', knots = 'NUDOS',
        km  = 'KM',   mi  = 'MI',  nm    = 'MN',
    },
}
Structure of a locale file (locales/es.lua), shortened. Keep the keys; translate the values.
⚠️A new locale file must be listed in fxmanifest.lua. The i18n loader and the language files must load before utils/seatbelt/main, which use _U(...) at load time (RegisterKeyMapping), so keep them in that order.