Skip to content

Translation

Type
Abstract Class
Namespace
craft\i18n
Inherits
craft\i18n\Translation
Since
4.0.0

Translation helper

View source

Public Methods

MethodDescription
prep()Prepares a source translation to be lazy-translated with translate().
translate()Lazy-translates a source translation that was prepared by prep().

prep()

Prepares a source translation to be lazy-translated with translate().

View source

Arguments

  • $category (string) – The message category.
  • $message (string) – The message to be translated.
  • $params (array) – The parameters that will be used to replace the corresponding placeholders in the message.
  • $language (string, null) – The language code (e.g. en-US, en). If this is null, the current application language will be used by default.

Returns

string – The translated message.

translate()

Lazy-translates a source translation that was prepared by prep().

View source

Arguments

  • $translation (string) – The prepared source translation.

Returns

string – The translated message.