How to create a div with translatable text in it

I am trying to add a div in a view _form before a specific input field, I can do it by simply using

and put my text in it, but I’d like to have it in different languages.

Right now I am using this

<?= Html::label(Yii::t('app', 'my-text-to-translate'), 'label1', ['class' => 'fz-hint']) ?>

and it works, but it is a lable, and I want a simple div without the for=“label1” part which is useless for my div.

I tried reading Helpers: Html | The Definitive Guide to Yii 2.0 | Yii PHP Framework but couldn’t get how to do it.

Thank you

[quote=“keneso, post:1, topic:132327”]
Yii::t(‘app’, ‘my-text-to-translate’)


you can try this, it works fine for me.

<?= Html::tag('div',Yii::t('app', 'my-text-to-translate'), [ 'id' => 'myID', 'class' =>'myClass, etc....]); ?>
1 Like

Thank you.
Works for me too.