echo \Yii::t('app','your.key.to.script'); //app -> represents the file name of the language you represent typically app.php inside your internationalized 2 digit lower case language key as folder name
The above code is to deliver the translated to text to the users.
The actual logic behind is the key "your.key.to.script" represents a short message key to identify the related translations. For example if you want to translate in English.
Your source folder > messages > en > app.php
return [
'your.key.to.script' => 'This is a strong to translate'
];