Bablo ResourcesDocs

Languages

The texts of Bablo Map Editor come from a JSON file in the locales folder: the editor, the tool panels, the Map Workshop, the confirm windows and the notifications. 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
-- locale file to use: locales/<locale>.json ('en', 'sv' — copy en.json to add your own language)
Config.Locale = "en"

locales/loader.lua loads locales/<locale>.json when the resource starts, on the server and on every player’s game. The game passes the texts on to the editor window when the window has loaded and each time the editor opens.

  • 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 server console and the F8 console print [bablo-mapeditor] could not load locales/<locale>.json, and the editor shows the key of every text, such as studio.tab.maps, instead of the text.

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


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, and keep the groups of en.json as they are:

    JSON
    "hint": {
        "exit": "Beenden",
        "move": "Bewegen",
  3. Set the language in config.lua:

    LUA
    Config.Locale = "de"
  4. Run refresh and then restart bablo-mapeditor 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 or a number, in the same order as in English.
  • Keep the file valid JSON, with the same groups as en.json. The script joins a group and a key with a dot, so "no_permission" inside "toast" becomes toast.no_permission.
  • Translate every key. A key that is missing from your file is not filled in from English: the editor and the notifications show the key itself, such as studio.maps.create.
  • en.json and sv.json hold the same keys, so either one works as a starting point.
  • The month and day names of the Workshop’s Schedule tab are in the file too, under studio.schedule. Keep their keys (1 to 12, mo to su).
  • Two English texts name numbers from config.lua: toast.invalid_distance (50 to 2000, from loadDistanceMin and loadDistanceMax in Config.Studio) and light.shadow_hint (8, from maxShadows in Config.Lights). If you change those settings, change the texts as well.
  • After an update, compare your file with the en.json of the update and add the keys you don’t have yet.

Texts that are not in the language file

Some texts are set in config.lua, typed in game or fixed in the script:

TextWhere it is set
The category names in the prop browserlabel in Config.Categories, see Categories
The names of the GTA props in the prop browserThe prop catalogue data/props.json that ships with the resource
The names of your own propslabel in Config.CustomProps, see Custom Props & Thumbnails
Map names, Workshop category names, prop labels, light names and schedule rule namesTyped by editors in game. The first map gets its name from Config.DefaultMapName, the first Workshop categories from the labels in Config.Categories. Changing the language later does not rename them.
The key labels of the key hint bar and the Keybinds tabkey in Config.Keybinds for Exit, Look, Free Cursor, Place, Brush, Rotate and Height, see Keybind hints. The other hints show the player’s own keys with names written by the script, such as SHIFT, CTRL and DEL.
The names of the key bindings in the GTA settingsFixed English: Map Editor: free cursor and Map Editor: stop thumbnail run, see Commands
Units and short timesFixed in the script: m and ° after numbers, and m, h and d in the Updated and When columns of the Workshop. Older dates use the date format of the game’s browser.
History entries for lights and schedule rulesThe action shows with its internal name, for example Ran light_create
Console lines and the messages of the test, thumbnail and catalogue commandsFixed English, for example [bablo-mapeditor] Database ready: 9 tables checked.