Skip to the content
Docs

Localization

On this page9

How to translate the texts of 5code-adminpanel, and which texts stay English in this version.

The short answer

PartLanguage
Notices, chat lines, kick and jail texts, command help, and every answer the server givesFrom the locale file. You can translate them.
The panel page itself: menu, page names, buttons, labels, dialogsEnglish, built into the page. Not translatable in this version.
The quick menu and the player's ticket chat windowEnglish, built into the page. Not translatable in this version.

The script ships in English only.

The files

FileWhat it is
locales/en.luaEvery English text of the game side, about 150 texts, grouped by topic. Copy this one.
locales/locale.luaThe loader. Do not edit it and do not copy it.
config.luaConfig.Locale chooses the language. Default: 'en'.

All files in locales/ are open and are loaded by themselves. You do not edit any other file.

Add a language

  1. Copy locales/en.lua to a new file with your language code, for example locales/de.lua.
  2. In the new file, change Locales['en'] to Locales['de'].
  3. Translate the text on the right side of each line. Do not change the key on the left.
  4. Keep every %s (see below).
  5. In config.lua set Config.Locale = 'de'.
  6. Save the file as UTF-8 and restart the server.
lua
Locales['de'] = {
    ['no_permission']   = 'Dafür hast du keine Berechtigung.',
    ['you_were_warned'] = 'Du wurdest verwarnt: %s',
    ['jail_time_left']  = 'Admin-Gefängnis: noch %s Min.',
    -- ...
}

The %s placeholders

A %s is replaced by a name, a number or a reason.

lua
['you_were_jailed'] = 'You were sent to admin jail for %s minute(s). Reason: %s',
RuleWhy
Keep the same number of %s as the English line.With too many, the line is shown raw, with the %s in it. With too few, a value is missing.
Keep their order.They are filled from left to right. Here: first the minutes, then the reason.

In two lines the %s is the name of the report command (Config.ReportCommand):

lua
['report_empty'] = 'Usage: /%s <message>',
['ticket_none']  = 'You have no open ticket. Use /%s <message> to ask staff for help.',

Write /%s in your translation, not /report. A line without the %s always says the word you typed, also after the command was renamed.

Missing texts

CaseWhat players see
A key is missing in your fileThe English text
Config.Locale names a language that has no fileEnglish
A key is missing in English tooThe key name itself

So a half-finished translation works. It is simply partly English. After an update, new texts show in English until you add them to your file (Updating).

What the locale file covers

Group in en.luaExamples
General"You do not have permission to do that."
CommandsThe help texts of /admin, /adminmenu, /report and /ticket in the chat. The name of the ticket key in the game's key settings.
Players"That player is no longer online." The status words: "In admin jail", "Driving", "Handcuffed".
Actions on a player"You have been kicked: …", "You have been warned: …", "You were frozen by staff.", "No clothing script was found to load your character." The default reasons "Kicked by staff" (Kick) and "Server maintenance" (Kick all).
Self tools and quick menu"Set a waypoint on the map first." The name of the sit room place.
World"Unknown weather type."
Bans and warnings"Banned until: …"
Staff notes"Write the note first."
Jail"Admin jail: … min left", "You were released from jail."
Tickets"New ticket #… from …", "Your ticket was sent to staff.", and the event lines in a ticket ("… claimed the ticket", "… left the server: the ticket is waiting again").
Sits"Staff brought you to a sit to talk to you."
Ranks and staff"You can only give permissions you have yourself."
Statistics, FairShield lookup"FairShield lookup failed. Try again later."

Some of these texts appear inside the English panel, for example an error message after a button, a player's status or an event line in a ticket. They follow your language too.

Texts that are somewhere else

TextWhere you change it
The ban message a banned player readsConfig.BanMessage in config.lua (Bans). Only the line "Banned until: …" under it is in the locale file.
Rank names (God, Admin, Moderator, Helper)On the Ranks & Staff page of the panel.
Names of the saved placeslabel in Config.Places (Quick menu and places).
Messages, announcements and the heads-up before a sitStaff type them. The heads-up has an English suggestion that staff can change before sending.

Always English in this version

  • The panel page, the quick menu and the ticket chat window (see the top of this page).
  • The success messages of the panel, for example "Ticket #1 claimed".
  • The rank name Super Admin and the word Player as ticket category.
  • The key names "Open admin dashboard" and "Open admin quick menu" in the game's key settings. They only exist if you set Config.DashboardKey or Config.MiniMenuKey.
  • The posts in your Discord channels (webhooks).
  • The lines in the server console.

Tips

  • Keep a copy of your language file outside the resource folder. An update brings a new folder.
  • Want to reword an English text? You can edit locales/en.lua. An update replaces it, so keep a copy.
  • Test a new language with the First Test: it shows most notices.

Questions? Ask on Discord (opens in a new tab).