translate

fun translate(key: String, defaultValue: String?, values: Map<String, String> = mapOf(), language: String = KlarityAPI.config.defaultLanguage): String

Translates a key to a string using the specified language, values and default value. If scripting is enabled, parses the string as a script and applies the middlewares.

Return

The translated, parsed and modified string

Parameters

key

The key to look up in the translation source

defaultValue

The default value to use if the key is not found

values

The values to pass to the script parser

language

The language code to use for translation