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
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"loadsen.json. - If the file is missing or empty,
en.jsonis used. - If the file is not valid JSON, the console prints
could not load locales/<locale>.jsonand 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
-
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"error.forbidden": "Das darfst du nicht.", -
Set the language in
config.lua:LUAConfig.Locale = "de" -
Run
refreshand thenrestart bablo-dealershipsin 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 an amount, in the same order as in English. -
Keep the file flat (
"key": "value"pairs, likeen.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.jsonandsv.jsonhold 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 fromConfig.PaymentMethods:JSON"payment.bank": "Bankkonto", -
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 or in game instead:
| Text | Where it is set |
|---|---|
| Vehicle category names | Config.Categories, see Categories |
| Rank names and descriptions | Config.Ranks, see Ranks |
| Payment method names | label in Config.PaymentMethods, unless your language file has a payment.<id> key |
| How money is written | Config.Currency, see Currency |
| Dates and units | Config.DateLocale, Config.SpeedUnit and Config.DistanceUnit, see Units and dates |
| Dealership names and blip names | The dealership creator, see Dealership Creator |
| Vehicle names and brands | The vehicle catalogue, see Vehicle Catalogue |

