Class Translator

Methods

setTranslations(language: string, locale: table<string, string>)
Modifier: static
Sets the translations for the current language. The values are allowed to use placeholders in the form of `$lua_expression$` for Lua expressions and `{key}` for values from a table. for the current language.
Parameters:
  • language (string): the name of the language to set the translations for
  • locale (table<string, string>): A table containing the translations
translate(key: string, values: table<string, any>): string
Modifier: static
Note: @nodiscard - Return value should not be ignored
Translates a key to the current language. The key is used to look up the translation in the current language, if the key dosn't exist, the key itself is returned. in the translation. Placeholders can be in the form of `$lua_expression$` for Lua expressions and `{key}` for values from the table.
Parameters:
  • key (string): the key of the translation to translate.
  • values (table<string, any>): replacement values to use for the placeholders
Returns: translated the translated and formatted string