Localization
On this page9
How to translate the texts of 5code-adminpanel, and which texts stay English in this version.
The short answer
| Part | Language |
|---|---|
| Notices, chat lines, kick and jail texts, command help, and every answer the server gives | From the locale file. You can translate them. |
| The panel page itself: menu, page names, buttons, labels, dialogs | English, built into the page. Not translatable in this version. |
| The quick menu and the player's ticket chat window | English, built into the page. Not translatable in this version. |
The script ships in English only.
The files
| File | What it is |
|---|---|
locales/en.lua | Every English text of the game side, about 150 texts, grouped by topic. Copy this one. |
locales/locale.lua | The loader. Do not edit it and do not copy it. |
config.lua | Config.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
- Copy
locales/en.luato a new file with your language code, for examplelocales/de.lua. - In the new file, change
Locales['en']toLocales['de']. - Translate the text on the right side of each line. Do not change the key on the left.
- Keep every
%s(see below). - In
config.luasetConfig.Locale = 'de'. - Save the file as UTF-8 and restart the server.
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.
['you_were_jailed'] = 'You were sent to admin jail for %s minute(s). Reason: %s',| Rule | Why |
|---|---|
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):
['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
| Case | What players see |
|---|---|
| A key is missing in your file | The English text |
Config.Locale names a language that has no file | English |
| A key is missing in English too | The 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.lua | Examples |
|---|---|
| General | "You do not have permission to do that." |
| Commands | The 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
| Text | Where you change it |
|---|---|
| The ban message a banned player reads | Config.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 places | label in Config.Places (Quick menu and places). |
| Messages, announcements and the heads-up before a sit | Staff 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.DashboardKeyorConfig.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).