Adding a language
The locales/ folder is yours. Nothing in the resource holds a list of
supported languages: fxmanifest.lua loads locales/*.lua as a glob, and a
locale exists because a file wrote a table into Locales. Drop a file in,
restart, it is there.
-
Copy
locales/en.luatolocales/<code>.lua. Use whatever code you like —fr,de,pt-BR,sv. The file name is not read; only the table key is. -
Change the table key on the first line:
Locales["fr"] = {. -
Translate the values. Leave the keys and any
%splaceholders alone — a file with the wrong number of%sfalls back to the unformatted string rather than taking the server down. -
Set the language in section 1, GENERAL, of
config.lua— the one setting there is for it:Config.Locale = "fr"Or leave it on
"auto"and set it inserver.cfginstead, if that is where your other resources take their language from:set nuggs:locale "fr""auto"readsnuggs:locale, thenesx:locale, thenqb:locale, and stops at the first one that is set. -
Restart and read the
localesline in the startup banner. It names the language in use, where it was configured, and every language that loaded:locales fr via config.lua - loaded: de, en, fr, pt-BRmcdiagreprints the same line at any time.
What the resource does for you
Section titled “What the resource does for you”locales/*.luais inescrow_ignoreand the manifest uses a glob, so a language you add is unencrypted, editable, and still there after an update. Updates only ever overwrite the files that ship with the resource.- The code you configure does not have to match the file exactly. Case is
ignored and
-and_are treated alike, soFR,fr,pt_BRandpt-brall find the right file. That matters most on"auto", where the code is whatever somebody typed intoserver.cfgmonths ago. "auto"works on the client too. A convar set withsetrather thansetris invisible to clients, which would leave the server speaking the chosen language while the character screen every player looks at stayed English. The server replicates whatever it resolves undernuggs:locale, so both halves agree without you having to know any of that.- A config with no
Config.Localein it still works. It is treated as"auto", so a config file written before this option existed keeps reading the convar it always read. - A regional code falls back to its base language and back again.
pt-BRfindslocales/pt.luaif that is what the folder holds, andptfindslocales/pt-BR.luaif that is. - A code with no file behind it is reported, once, in the console, with the list of languages that did load and what to copy. It does not fail silently into English.
- Missing keys fall back to English, key by key, on the Lua side and inside the interface alike — so a partial translation is safe to ship, and a translation written against an older build keeps working when an update adds a string. An empty string counts as a key nobody has reached yet and uses English too, so you can leave blanks in as you work.
- Keys are found in both halves of the file. Strings the interface renders
live under
UI, everything else at the top level, but a lookup checks both, so a key does not have to be in the half you would expect.
What is not translatable
Section titled “What is not translatable”The resource name lock’s messages. The folder this resource lives in must be
named nuggs_multicharacter, and everything that says so is hard-coded in an
encrypted file. A message whose only job is to tell a server owner how to fix
their install has to survive a translation that dropped the key.
Sharing a translation
Section titled “Sharing a translation”The file is plain Lua and depends on nothing else in the resource, so it can be handed to another server as-is. If you would like a language added to the shipped set, send the file in and it will go out with the next release under your name.
