Bablo ResourcesDocs

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

LUA
Config.Locale = 'en' -- en or sv

Loads 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' loads en.json.
  • If the file is missing or empty, en.json is used.
  • If the file is not valid JSON, the console prints [bablo-electricjob] could not load locales/<locale>.json and 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

  1. Copy locales/en.json to locales/<code>.json, for example locales/de.json. Use lower case letters and no - in the file name, because everything from the first - in Config.Locale is dropped.

  2. Translate the values, never the keys:

    JSON
    "acceptInvite": "Crew beitreten",
  3. Set the language in config.lua:

    LUA
    Config.Locale = 'de'
  4. Run refresh and then restart bablo-electricjob in the server console, so the server picks up the added file.

Tips

  • Keep every %s in 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 after key: on it, so you may translate that text.
  • Keep the file flat ("key": "value" pairs, like en.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.autoRouteTitle and creator.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.json and sv.json hold the same keys, so either one works as a starting point.
  • After an update, compare your file with the en.json of 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:

TextWhere it is set
Route names, descriptions, complexity and estimated timeorders in Config.Job, see Orders, or the Route Creator
Box namessites in Config.Job, see Sites, or the route creator
The name in the menu header and of the depot blipConfig.Brand, see Brand, and label in the depot blip
How money is written in the menuUS dollars, in the Swedish number format when Config.Locale is sv. See Currency
The target options at the dispatcher and at the boxesFixed 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 scriptFixed 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 boxesFixed English in the script, for example SUPPLY LIVE and FUSE BLOWN
The names of the key bindings in the GTA settingsFixed English in the script, see Commands