Translation
- Type
- Abstract Class
- Namespace
- craft\i18n
- Inherits
- craft\i18n\Translation
- Since
- 4.0.0
Translation helper
View source (opens new window)
# Public Methods
Method | Description |
---|---|
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 (opens new window)
Arguments
$category
(string (opens new window)) – The message category.$message
(string (opens new window)) – The message to be translated.$params
(array (opens new window)) – The parameters that will be used to replace the corresponding placeholders in the message.$language
(string (opens new window), null (opens new window)) – The language code (e.g.en-US
,en
). If this isnull
, the current application language (opens new window) will be used by default.
Returns
string (opens new window) – The translated message.
# translate()
Lazy-translates a source translation that was prepared by prep().
View source (opens new window)
Arguments
$translation
(string (opens new window)) – The prepared source translation.
Returns
string (opens new window) – The translated message.