i am using Yii:t() to do the translation. but i want to add an edit link beside these translated text. so i can just click on the link, then it will take me to the edit page, and i can easily do the update.
the thing i am currently doing is adding a place holder to the text. that is 'translated text#my place holder#';
then i use Yii's afterRender() to preg_replace these place holder with some html tags, so i can manipulate using javascript later.
however if these html tags are put into tag, it would break.
so how can i replace the place holder with html tags and handle ,, .etc.
i know yii has a translate module , but the link it add will take me to the admin page, show all translation, not the exact one.
If you need to create a translation with a link inside of it, use this structure:
<?php
echo Yii::t(
'login',
'New user? {link:signup}Create an account{/link}',
array(
'{link:signup}'=>'<a href="'.CHtml::normalizeUrl(array('/user/signUp')).'">',
'{/link}'=>'</a>',
)
);
?>
You use placeholder for link start and link end.