Languages & translations
The game UI can run in 9 languages: en, pt, de, pl, tr, es, fr, it, ru. Not every string is translated yet, anything missing falls back to English.
How it works
Section titled “How it works”- Each player’s choice is saved per account (
bs_users.language, added by migration030_user_language.sql) and published on the player state bagbs_lang. - An empty choice means “follow the server default”. The default comes from F1
Global.defaultLanguage, else thebs_defaultLanguageconvar, elseen. It’s onGlobalState.bs_defaultLang. - Players change it in the inventory Settings tab. That fires
bs_core:setLanguage, and every resource updates live, no reconnect. exports.bs_core:GetLanguage(src)gives you a player’s language on the server.
Translating a resource
Section titled “Translating a resource”Resources with a locales/ folder so far: bs_admin, bs_bodily, bs_boosters, bs_building, bs_chat, bs_cinecam, bs_core, bs_crafting, bs_drugs, bs_economy, bs_emotes, bs_events, bs_extraction, bs_faction_bases, bs_factions, bs_gadgets, bs_gates, bs_interactions, bs_inventory, bs_jobs, bs_medical, bs_menu, bs_mining, bs_multichar, bs_radial, bs_recycler, bs_scenes, bs_scoreboard, bs_skills, bs_stash, bs_tester, bs_traders, bs_ui, bs_vehicles, bs_vip, bs_weapons, bs_zombies.
The Lua and NUI functions are on Locales API.
1. fxmanifest
Section titled “1. fxmanifest”shared_script '@bs_core/shared/sh_locale.lua'files { 'locales/*.lua' }2. locales/<lang>.lua
Section titled “2. locales/<lang>.lua”Each file returns a flat table. {name} is a placeholder.
-- locales/en.luareturn { ['ui.level'] = 'LEVEL', ['msg.picked_up'] = 'You picked up {item}.',}Copy en.lua to pt.lua (and so on) and translate the values. Never translate the keys. A missing key falls back to English, then to the key itself, so a half done file is fine.
3. Lua
Section titled “3. Lua”-- client: the local player's languagelocal s = L('msg.picked_up', { item = 'Bandage' })
-- server: L(src, key, vars) or Lp(src, key, vars) uses that player's languageTriggerClientEvent('chat:addMessage', src, { args = { L(src, 'msg.picked_up', { item = 'Bandage' }) } })
-- server without a source: the server defaultprint(L('msg.picked_up', { item = 'Bandage' }))BSLocale.OnChange(function(lang) ... end) runs on the client when the language changes, for text you built yourself.
4. NUI
Section titled “4. NUI”If the resource has a ui_page, the locale script sends the merged table to the page. Load the shared helper before your page script:
<script src="nui://bs_ui/html/js/i18n.js"></script>Then mark up the HTML. The English text in the markup is the fallback:
<span data-i18n="ui.level">LEVEL</span><p data-i18n-html="ui.help_html">Press <b>E</b></p><input data-i18n-attr="placeholder:ui.search;title:ui.search_tip" placeholder="Search">In JS use t('key', { name: 'x' }) and BSI18n.onChange(fn) to re-render dynamic text.
- Keep keys stable and grouped (
ui.,msg.,err.). Changing a key breaks every translation of it. - Don’t put game balance text with numbers baked in, use placeholders so the number follows the config.
bs19.org · Privacy · Terms · Cookie settings
Cookies and outside content
The site only needs two essential cookies to keep you logged in and protect forms. Videos and streams from YouTube and Twitch load from their servers, which can set their own cookies, so they stay off until you say yes. Nothing is pre-ticked and you can change your mind any time with "Cookie settings" at the bottom of every page. Details.
Questions about the server, the framework or the site? A real person reads this, usually within a day.