Languages
The texts of Bablo Electrician Job come from a JSON file in the locales folder: the work order menu, the invitation pop-up, the mission panel, the tips and the route creator. English (en.json) and Swedish (sv.json) ship with the resource.
There is one language for the whole server. Players cannot pick their own.
Server language
Config.Locale = 'en' -- en or svLoads locales/<locale>.json when the resource starts, on the server and on every player’s game.
- A region part is ignored and capital letters don’t matter, so
'en-US'loadsen.json. - If the file is missing or empty,
en.jsonis used. - If the file is not valid JSON, the console prints
[bablo-electricjob] could not load locales/<locale>.jsonand the menus show English.
A language file is only read when the resource starts. After you change one, run restart bablo-electricjob.
Adding a language
-
Copy
locales/en.jsontolocales/<code>.json, for examplelocales/de.json. Use lower case letters and no-in the file name, because everything from the first-inConfig.Localeis dropped. -
Translate the values, never the keys:
JSON"acceptInvite": "Crew beitreten", -
Set the language in
config.lua:LUAConfig.Locale = 'de' -
Run
refreshand thenrestart bablo-electricjobin the server console, so the server picks up the added file.
Tips
- Keep every
%sin a value. It is replaced with a name, a number or a time, in the same order as in English. - Keep the key markers in the tips, such as
{key:E},{key:LMB}and{key:Esc}. They are drawn as a key cap with the text afterkey:on it, so you may translate that text. - Keep the file flat (
"key": "value"pairs, likeen.json) and valid JSON. - You don’t have to translate everything at once. A key that is missing from your file shows in English in the menus.
- Four keys are read by the game script itself:
creator.autoCabinet,creator.autoFuseBox,creator.autoRouteTitleandcreator.autoRouteFallback. The route creator names boxes and routes with them. If one of them is missing, the key itself becomes the name, so keep all four. - Names the route creator gave are saved with the box or route. Changing the language later does not rename them.
en.jsonandsv.jsonhold the same keys, so either one works as a starting point.- After an update, compare your file with the
en.jsonof the update and translate the keys you don’t have yet.
Texts that are not in the language file
Some texts are set in config.lua, in the route creator or in the script itself:
| Text | Where it is set |
|---|---|
| Route names, descriptions, complexity and estimated time | orders in Config.Job, see Orders, or the Route Creator |
| Box names | sites in Config.Job, see Sites, or the route creator |
| The name in the menu header and of the depot blip | Config.Brand, see Brand, and label in the depot blip |
| How money is written in the menu | US dollars, in the Swedish number format when Config.Locale is sv. See Currency |
| The target options at the dispatcher and at the boxes | Fixed English in the script: Electrician work orders, Collect work van, Return van and get paid, Open service cabinet, Open fuse box, Monitor the circuit and Stop monitoring |
| Notifications and error messages from the script | Fixed English in the script, for example Move closer to the cabinet. and Work order settled. You earned $1500. |
| The screens on the breaker cabinets and fuse boxes | Fixed English in the script, for example SUPPLY LIVE and FUSE BLOWN |
| The names of the key bindings in the GTA settings | Fixed English in the script, see Commands |

