t() public static method
Translates a message to the specified language.
This is a shortcut method of yii\i18n\I18N::translate().
The translation will be conducted according to the message category and the target language will be used.
You can add parameters to a translation message that will be substituted with the corresponding value after translation. The format for this is to use curly brackets around the parameter name as you can see in the following example:
$username = 'Alexander'; echo \Yii::t('app', 'Hello, {username}!', ['username' => $username]);
Further formatting of message parameters is supported using the PHP intl extensions message formatter. See yii\i18n\I18N::translate() for more details.
public static string t ( $category, $message, $params = [], $language = null ) | ||
---|---|---|
$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 |
The language code (e.g. |
return | string |
The translated message. |
Please login to continue.