Adding Locale / Translations
Learn how to add your own language to the locale system.
Start by creating a copy of en.ts from the src/core/shared/locale/languages folder and name it any ISO-639-1 two letter code. It needs to be a TypeScript file.
Example for English is: en Example for Deutsch is: de Example for Español is: es Example for русский is: ru
Inside the file you have just created you will have English examples. Translate them.
Variable placeholders are written with: % Variables will be replaced at runtime.
Locales must be written and present at the time of bootup.
setLanguage function must be used on client-side in order to change the language to your respective ISO-639-1 two letter code.

Importing into Locales

Inside of locale.ts in the src/core/shared/locale folder you'll find a bit of code for locales.
1
const locales: LocaleFormat = {
2
en
3
// Additional languages can be added here...
4
};
Copied!
You need to import your locale. Here is how I would import a Deutsch locale.
1
import de from './languages/de'; // Importing the English Locale
2
3
const locales: LocaleFormat = {
4
en,
5
de
6
// Additional languages can be added here...
7
};
Copied!

Using a Locale

Once a locale is created you can change en in the same file of src/core/shared/locale to whatever your two-letter language identifier is. This will automatically convert most of the game mode to whatever language was written in your locale file.
Last modified 3mo ago