Bablo ResourcesDocs

Languages

The texts of Bablo Dealerships come from a JSON file in the locales folder: the panels, the prompts in the world, the notifications and the notes the server writes on dealership transactions. English (en.json) and Swedish (sv.json) ship with the resource.

There is one language for the whole server. Players and staff cannot pick their own.


Server language

LUA
Config.Locale = "en"

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 could not load locales/<locale>.json and every text shows in English.

A language file is only read when the resource starts. After you change one, run restart bablo-dealerships.


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
    "error.forbidden": "Das darfst du nicht.",
  3. Set the language in config.lua:

    LUA
    Config.Locale = "de"
  4. Run refresh and then restart bablo-dealerships 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 an amount, in the same order as in English.

  • Keep the file flat ("key": "value" pairs, like en.json) and valid JSON. With a file that is not valid JSON the panels also need about 15 seconds longer to get ready for each player who joins.

  • You don’t have to translate everything at once. A key that is missing from your file shows in English.

  • en.json and sv.json hold the same keys, so either one works as a starting point.

  • To translate the name of a payment method, add a payment.<id> key, where the id comes from Config.PaymentMethods:

    JSON
    "payment.bank": "Bankkonto",
  • 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 or in game instead:

TextWhere it is set
Vehicle category namesConfig.Categories, see Categories
Rank names and descriptionsConfig.Ranks, see Ranks
Payment method nameslabel in Config.PaymentMethods, unless your language file has a payment.<id> key
How money is writtenConfig.Currency, see Currency
Dates and unitsConfig.DateLocale, Config.SpeedUnit and Config.DistanceUnit, see Units and dates
Dealership names and blip namesThe dealership creator, see Dealership Creator
Vehicle names and brandsThe vehicle catalogue, see Vehicle Catalogue