Translation ​
- Type
- Abstract Class
- Namespace
- craft\i18n
- Inherits
- craft\i18n\Translation
- Since
- 4.0.0
Translation helper
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().
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 isnull
, 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().
Arguments ​
$translation
(string) – The prepared source translation.
Returns ​
string – The translated message.