locales folder, one file per
language. You can reword any text, and add a language the product does not ship, without waiting for
an update.
How a product picks its language
Each product works in one of two ways. Its configuration overview says which.Before you start
- The language files are in the product’s folder, for example
resources/[element]/element_3d_pausemenu/locales/en.json. - Keep a copy of every file you change. An update replaces them. See Update a product.
Steps
Choose the server’s language
For a product that uses one language for the server:
Each value is the name of a file in
locales without .json: it means locales/it.json. Restart
the resource to apply it.
Choose the language players start in, and add the server’s own
For a product that follows each player’s game,configs/locales.jsonc holds what the game cannot
offer: languages it does not have, such as Swedish, and the language a player sees before they have
picked one.
Every player can still change the language from the product’s own settings. Their pick is kept on
their own machine, for this server, and wins over
default from then on, including when you change
default later. Picking the language their game is in makes the product follow the game again.
A language in extra changes only the product’s own text. The game has no Swedish to switch to,
so its own menus stay in the language the game is set to.
Each language in extra needs its file in locales, listed in fxmanifest.lua; see
Add a language. Restart the resource to apply a change.
Reword a piece of text
Open the file for the language players see and change the text after the colon. Keep the key, the quotes and the braces as they are:{count} or {name}. Keep them, with
the same names. A renamed placeholder is replaced with nothing and leaves a gap in the sentence.
Some text changes with a number:
# is the number. =0 matches exactly zero. one and other are chosen by the language’s grammar:
Always keep
other in a plural.
Add a language
1
Copy a language file
Copy
locales/en.json to a new file named after the language.For a product that follows the player’s game, use the game’s own name for one of its
languages, so that players whose game is in it see it:Any other language is one of the server’s: name the file after it, such as
sv.json for
Swedish, and add it to extra in a later step.2
Translate the text
Translate the text after each colon. Keep every key and every placeholder. A key you have not
translated yet shows the fallback language, so a half-finished file is usable.
3
List the file in fxmanifest.lua
Add it to the Without this line the file never reaches players, and the language seems to do nothing.
files block in the product’s fxmanifest.lua, next to the language files already
there:4
Make it available, for a product that uses one language for the server
In A product that follows the player’s game reads only
configs/locales.jsonc, add it to available and, to use it, set active. available
replaces the shipped list, so keep the languages already in it:extra and default there: skip this step
for a game language.5
Add it to extra, for a server language of a product that follows the player's game
In
configs/locales.jsonc, add the file’s name and the name players see, and set default to it
if players should start in it:6
Restart the resource
Check that it worked
Join the server and confirm the text is in the expected language everywhere, with no key names such asmap.waypoint on screen and no gaps in sentences. Look at a screen that shows a count too, so the
plural forms are covered.
When text is missing
Text is looked up by its key in three places, in order:- the language the player sees;
- the fallback language: English for a product that follows the player’s game,
fallbackfor one that uses one language for the server; - nowhere: the key itself appears on screen, for example
map.waypoint.
.jsonc like configuration files: leave comments out of them.
For a product that follows each player’s game, an entry that cannot work is left out and the console
says why, once per start:
- an
activethat is not inavailableusesfallbackinstead; - a
fallbackthat is not inavailableuses the first language inavailable.