@elemental/common / Function

translate

Returns a Signal containing the always-updated translation of the given phrase. The translation is re-calculated whenever:

  • A new translation is provided via the addTranslations function
  • The replacements change (if their value is represented by a Signal)
  • The language changes
  • The global label replacements change

Presentation

function translate(
  module: string,
  phrase: string,
  replacements: LmnLabelReplacements = {},
  variableDelimiters: [string, string] = ["{", "}"],
): Signal<string>;

Returns

Signal<string>

Parameters

NameTypeDescription
module
string

@param module The module containing the phrase to display.

phrase
string

@param phrase The phrase to display.

replacements
LmnLabelReplacements

@param replacements Any replacements to be applied to the translated phrase.

variableDelimiters
[string, string]

@param variableDelimiters The delimiters with which the parts to be replaced are padded in the label. Defaults to { }.