How To I18N A Sentence?

example I have a Sentence include some links:

    Jim  visit  Tom's profile page.  

jim and tom are links to their profile page.

how to do i18n with this sentence?

I need transelate the sentence to russian, jpanese, chinese …

Well, you can just include the whole sentence. There will be some HTML but it’s OK, isn’t it?

I would configure three messages:


    '{link1} visit {link2}' => 'translated_msg1',

    'Jim' => 'translated_msg2',

    'Tom' => 'translated_msg3',


Then in your view/code use it like this:

    echo Yii::t('app', '{link1} visit {link2}', [

        'link1' => Html::a(Yii::t('app', 'Jim'), $url1),

        'link2' => Html::a(Yii::t('app', 'Tom'), $url2),