I am trying to implement a small tool in my site so i can search for all Yii::t and write them into the corresponding files in the messages folder. But I have some problems with my expression.
preg_match_all("/Yii[:]{2}t\(['|\"](.+?)['|\"],[\s]+['|\"](.+?)['|\"].*\)/im", $content, $matches, PREG_SET_ORDER);It finds something like:
Yii::t('User', 'User deleted')but here are my problems:
- It does not find Yii::t('User', 'add add"asdasd') I don't know how to exclude the quote which is not around the string. "/Yii[:]{2}t\(['(.+?)'|\"(.+?)\"],[\s]+['(.+?)'|\"(.+?)\"].*\)/im" does not work...
- It does not find the translations with parameters. For example Yii::t('User', 'add {gbf}', array('{gbf}' => 1)).
I think this would be a quite useful tool, but regular expressions are something i will never learn:(
Thanks

Help











