Localization
Every player-facing string in F5 Redeem Code — panels, toasts, notifications and server messages — comes from a locale file, so the whole resource can be translated by editing plain Lua tables.
Bundled languages
The script ships with two languages:
| Code | Language | File |
|---|---|---|
en | English | locales/en.lua |
pl | Polish | locales/pl.lua |
Select the active one in the config:
F5Cfg.Locale = 'en' -- 'en' or 'pl'
How translations resolve
A locale file assigns a flat key→string table under its code:
Locales = Locales or {}
Locales['en'] = {
['redeem_title'] = 'Redeem Code',
['redeem_success'] = 'Code redeemed successfully!',
['reward_item'] = '%s x%d',
-- ...
}
Strings are looked up through two shared helpers (identical behaviour):
_L('redeem_success') -- "Code redeemed successfully!"
Translate('reward_item', 'Water', 3) -- "Water x3"
Resolution order for any key:
- The active language (
F5Cfg.Locale) - English (
en) as a fallback - The key itself, if it exists in neither
Extra arguments are passed through string.format, so placeholders like %s and %d are filled in safely (a malformed format string falls back to the raw string instead of erroring).
Because English is always the fallback, a translation file may be partial — any key you don't translate automatically shows the English text. You never end up with a blank or a raw key on screen.
Server vs NUI strings
- Server-side messages (redeem results, admin notifications) are translated with
Translate(...)and sent to the client. - NUI strings are delivered as a bundle: on every panel open the server calls
BuildLocaleBundle(), which merges the full English table as a base and overlays the active language, then ships it to the interface. The panel renders labels from that bundle.
The special key locale_code (e.g. en-US) is provided for locale-aware formatting inside the NUI.
Adding a language
- Copy
locales/en.luatolocales/<code>.lua(e.g.locales/de.lua). - Rename the table to your code:
locales/de.lua
Locales = Locales or {}
Locales['de'] = {
['redeem_title'] = 'Code einlösen',
['redeem_success'] = 'Code erfolgreich eingelöst!',
-- ... translate every value
} - Translate the values only — keep the keys unchanged. Preserve
%s/%dplaceholders and their order. - Update
locale_codeto your locale (e.g.de-DE). - Point the config at it:
config/config.lua
F5Cfg.Locale = 'de' - Restart the resource.
New files are picked up automatically — the manifest loads locales/*.lua, so there's nothing else to register.
The set of keys is defined by locales/en.lua. When you update the script and new keys are added there, add them to your translation too — until then those specific strings fall back to English.
See Also
- Configuration → General — the
Localeoption - Installation — choosing your language during setup